cdk-real-drift 0.9.7 → 0.9.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/dist/cli.js +126 -7
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -283,7 +283,8 @@ snapshots its full live model and watches it, `ignore` accepts it, or `revert`
|
|
|
283
283
|
- **AppSync**: data sources, resolvers, functions
|
|
284
284
|
- **CloudWatch Logs**: metric filters, subscription filters
|
|
285
285
|
- **ELBv2**: listeners, listener rules
|
|
286
|
-
- **EC2**: VPC subnets, VPC endpoints, route
|
|
286
|
+
- **EC2**: VPC subnets, VPC endpoints, VPC route tables, VPC network ACLs, route
|
|
287
|
+
table routes
|
|
287
288
|
- **ECS**: cluster services
|
|
288
289
|
- **KMS**: key aliases
|
|
289
290
|
- **AppConfig**: application environments, configuration profiles
|
package/dist/cli.js
CHANGED
|
@@ -4023,6 +4023,40 @@ function typeChangeReplaceInfo(changed, templateResources, deployedTypeOf, stack
|
|
|
4023
4023
|
const more = changed.length > shown.length ? `, …(+${changed.length - shown.length} more)` : "";
|
|
4024
4024
|
return `info: ${stackName}: ${changed.length} resource(s) changed Type at the same logical id — the next deploy will REPLACE them (old resource deleted, new created): ${shown.join(", ")}${more}`;
|
|
4025
4025
|
}
|
|
4026
|
+
function collectReferencedNames(node, out = /* @__PURE__ */ new Set()) {
|
|
4027
|
+
if (Array.isArray(node)) {
|
|
4028
|
+
for (const x of node) collectReferencedNames(x, out);
|
|
4029
|
+
return out;
|
|
4030
|
+
}
|
|
4031
|
+
if (node && typeof node === "object") for (const [k, v] of Object.entries(node)) if (k === "Ref" && typeof v === "string") out.add(v);
|
|
4032
|
+
else if (k === "Fn::Sub") {
|
|
4033
|
+
const tmpl = Array.isArray(v) ? v[0] : v;
|
|
4034
|
+
if (typeof tmpl === "string") for (const m of tmpl.matchAll(/\$\{([^}]+)\}/g)) {
|
|
4035
|
+
const name = m[1]?.trim();
|
|
4036
|
+
if (!name || name.startsWith("!")) continue;
|
|
4037
|
+
const base = name.split(".")[0];
|
|
4038
|
+
if (base) out.add(base);
|
|
4039
|
+
}
|
|
4040
|
+
collectReferencedNames(v, out);
|
|
4041
|
+
} else collectReferencedNames(v, out);
|
|
4042
|
+
return out;
|
|
4043
|
+
}
|
|
4044
|
+
function unpreviewableParamInfo(template, stackParams, stackName) {
|
|
4045
|
+
const paramDefs = template.Parameters ?? {};
|
|
4046
|
+
const noValue = Object.entries(paramDefs).filter(([k, def]) => {
|
|
4047
|
+
if (def?.NoEcho === true || def?.NoEcho === "true") return false;
|
|
4048
|
+
if ((def?.Type ?? "").includes("::Parameter::Value<")) return false;
|
|
4049
|
+
if (def && "Default" in def) return false;
|
|
4050
|
+
return !(k in stackParams);
|
|
4051
|
+
}).map(([k]) => k);
|
|
4052
|
+
if (noValue.length === 0) return null;
|
|
4053
|
+
const referenced = collectReferencedNames(template.Resources ?? {});
|
|
4054
|
+
const unpreviewable = noValue.filter((k) => referenced.has(k)).sort();
|
|
4055
|
+
if (unpreviewable.length === 0) return null;
|
|
4056
|
+
const shown = unpreviewable.slice(0, 10);
|
|
4057
|
+
const more = unpreviewable.length > shown.length ? `, …(+${unpreviewable.length - shown.length} more)` : "";
|
|
4058
|
+
return `warning: ${stackName}: ${unpreviewable.length} local parameter(s) have NO value under --pre-deploy (new/renamed, no Default, absent from the deployed stack) — every declared property that Refs them resolves UNRESOLVED and was NOT compared (cannot preview): ${shown.join(", ")}${more}`;
|
|
4059
|
+
}
|
|
4026
4060
|
function partitionForRegion(region) {
|
|
4027
4061
|
if (region.startsWith("us-gov-")) return {
|
|
4028
4062
|
partition: "aws-us-gov",
|
|
@@ -4157,6 +4191,8 @@ async function loadDesired(client, stackName, region, templateOverride, recovery
|
|
|
4157
4191
|
if (templateOverride) {
|
|
4158
4192
|
const deletedInfo = deletedResourceInfo(physIds, template, stackName);
|
|
4159
4193
|
if (deletedInfo) console.error(deletedInfo);
|
|
4194
|
+
const noValueInfo = unpreviewableParamInfo(template, stackParams, stackName);
|
|
4195
|
+
if (noValueInfo) console.error(noValueInfo);
|
|
4160
4196
|
}
|
|
4161
4197
|
const templateResourcesForTypeCheck = template.Resources ?? {};
|
|
4162
4198
|
const typeChanged = new Set(typeChangedResources(templateResourcesForTypeCheck, deployedTypeOf));
|
|
@@ -7563,6 +7599,34 @@ function diffVpcEndpointChildren(input) {
|
|
|
7563
7599
|
}
|
|
7564
7600
|
return added;
|
|
7565
7601
|
}
|
|
7602
|
+
function diffVpcRouteTableChildren(input) {
|
|
7603
|
+
const declared = new Set(input.declaredRouteTableIds);
|
|
7604
|
+
const added = [];
|
|
7605
|
+
for (const rt of input.liveRouteTables) {
|
|
7606
|
+
if (declared.has(rt.id)) continue;
|
|
7607
|
+
added.push({
|
|
7608
|
+
resourceType: "AWS::EC2::RouteTable",
|
|
7609
|
+
identifier: rt.id,
|
|
7610
|
+
label: rt.label ?? rt.id,
|
|
7611
|
+
live: { RouteTableId: rt.id }
|
|
7612
|
+
});
|
|
7613
|
+
}
|
|
7614
|
+
return added;
|
|
7615
|
+
}
|
|
7616
|
+
function diffVpcNaclChildren(input) {
|
|
7617
|
+
const declared = new Set(input.declaredNaclIds);
|
|
7618
|
+
const added = [];
|
|
7619
|
+
for (const n of input.liveNacls) {
|
|
7620
|
+
if (declared.has(n.id)) continue;
|
|
7621
|
+
added.push({
|
|
7622
|
+
resourceType: "AWS::EC2::NetworkAcl",
|
|
7623
|
+
identifier: n.id,
|
|
7624
|
+
label: n.label ?? n.id,
|
|
7625
|
+
live: { Id: n.id }
|
|
7626
|
+
});
|
|
7627
|
+
}
|
|
7628
|
+
return added;
|
|
7629
|
+
}
|
|
7566
7630
|
async function pageSubnets(client, vpcId) {
|
|
7567
7631
|
const out = [];
|
|
7568
7632
|
let next;
|
|
@@ -7595,16 +7659,52 @@ async function pageVpcEndpoints(client, vpcId) {
|
|
|
7595
7659
|
} while (next);
|
|
7596
7660
|
return out;
|
|
7597
7661
|
}
|
|
7662
|
+
async function pageVpcRouteTables(client, vpcId) {
|
|
7663
|
+
const out = [];
|
|
7664
|
+
let next;
|
|
7665
|
+
do {
|
|
7666
|
+
const res = await client.send(new DescribeRouteTablesCommand({
|
|
7667
|
+
Filters: [{
|
|
7668
|
+
Name: "vpc-id",
|
|
7669
|
+
Values: [vpcId]
|
|
7670
|
+
}],
|
|
7671
|
+
NextToken: next
|
|
7672
|
+
}));
|
|
7673
|
+
out.push(...res.RouteTables ?? []);
|
|
7674
|
+
next = res.NextToken;
|
|
7675
|
+
} while (next);
|
|
7676
|
+
return out;
|
|
7677
|
+
}
|
|
7678
|
+
async function pageNetworkAcls(client, vpcId) {
|
|
7679
|
+
const out = [];
|
|
7680
|
+
let next;
|
|
7681
|
+
do {
|
|
7682
|
+
const res = await client.send(new DescribeNetworkAclsCommand({
|
|
7683
|
+
Filters: [{
|
|
7684
|
+
Name: "vpc-id",
|
|
7685
|
+
Values: [vpcId]
|
|
7686
|
+
}],
|
|
7687
|
+
NextToken: next
|
|
7688
|
+
}));
|
|
7689
|
+
out.push(...res.NetworkAcls ?? []);
|
|
7690
|
+
next = res.NextToken;
|
|
7691
|
+
} while (next);
|
|
7692
|
+
return out;
|
|
7693
|
+
}
|
|
7598
7694
|
async function enumerateVpcChildren(ctx) {
|
|
7599
7695
|
const { parent, desired, region } = ctx;
|
|
7600
7696
|
const vpcId = parent.physicalId;
|
|
7601
7697
|
if (!vpcId) return [];
|
|
7602
7698
|
const declaredSubnetIds = [];
|
|
7603
7699
|
const declaredEndpointIds = [];
|
|
7700
|
+
const declaredRouteTableIds = [];
|
|
7701
|
+
const declaredNaclIds = [];
|
|
7604
7702
|
for (const r of desired.resources) {
|
|
7605
7703
|
if (!parentRefMatches(r.declared.VpcId, vpcId) || !r.physicalId) continue;
|
|
7606
7704
|
if (r.resourceType === "AWS::EC2::Subnet") declaredSubnetIds.push(r.physicalId);
|
|
7607
7705
|
else if (r.resourceType === "AWS::EC2::VPCEndpoint") declaredEndpointIds.push(r.physicalId);
|
|
7706
|
+
else if (r.resourceType === "AWS::EC2::RouteTable") declaredRouteTableIds.push(r.physicalId);
|
|
7707
|
+
else if (r.resourceType === "AWS::EC2::NetworkAcl") declaredNaclIds.push(r.physicalId);
|
|
7608
7708
|
}
|
|
7609
7709
|
const client = new EC2Client({
|
|
7610
7710
|
region,
|
|
@@ -7618,13 +7718,32 @@ async function enumerateVpcChildren(ctx) {
|
|
|
7618
7718
|
id: e.VpcEndpointId,
|
|
7619
7719
|
label: e.ServiceName ?? e.VpcEndpointId
|
|
7620
7720
|
}));
|
|
7621
|
-
|
|
7622
|
-
|
|
7623
|
-
|
|
7624
|
-
})
|
|
7625
|
-
|
|
7626
|
-
|
|
7627
|
-
|
|
7721
|
+
const liveRouteTables = (await pageVpcRouteTables(client, vpcId)).filter((rt) => typeof rt.RouteTableId === "string").filter((rt) => !(rt.Associations ?? []).some((a) => a.Main === true)).map((rt) => ({
|
|
7722
|
+
id: rt.RouteTableId,
|
|
7723
|
+
label: rt.RouteTableId
|
|
7724
|
+
}));
|
|
7725
|
+
const liveNacls = (await pageNetworkAcls(client, vpcId)).filter((n) => typeof n.NetworkAclId === "string").filter((n) => n.IsDefault !== true).map((n) => ({
|
|
7726
|
+
id: n.NetworkAclId,
|
|
7727
|
+
label: n.NetworkAclId
|
|
7728
|
+
}));
|
|
7729
|
+
return [
|
|
7730
|
+
...diffVpcChildren({
|
|
7731
|
+
declaredSubnetIds,
|
|
7732
|
+
liveSubnets
|
|
7733
|
+
}),
|
|
7734
|
+
...diffVpcEndpointChildren({
|
|
7735
|
+
declaredEndpointIds,
|
|
7736
|
+
liveEndpoints
|
|
7737
|
+
}),
|
|
7738
|
+
...diffVpcRouteTableChildren({
|
|
7739
|
+
declaredRouteTableIds,
|
|
7740
|
+
liveRouteTables
|
|
7741
|
+
}),
|
|
7742
|
+
...diffVpcNaclChildren({
|
|
7743
|
+
declaredNaclIds,
|
|
7744
|
+
liveNacls
|
|
7745
|
+
})
|
|
7746
|
+
];
|
|
7628
7747
|
}
|
|
7629
7748
|
function diffRouteTableChildren(input) {
|
|
7630
7749
|
const { routeTableId, declaredCidrs, liveRoutes, hasUnresolvedDeclaredRoute } = input;
|