cdk-real-drift 0.9.6 → 0.9.8
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/dist/cli.js +78 -11
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -2985,12 +2985,18 @@ const VALUE_INDEPENDENT_DEFAULT_TOPLEVEL_PATHS = {
|
|
|
2985
2985
|
"AWS::Glue::Job": new Set(["MaxCapacity", "AllocatedCapacity"]),
|
|
2986
2986
|
"AWS::EC2::SecurityGroupIngress": new Set(["SourceSecurityGroupName"]),
|
|
2987
2987
|
"AWS::EC2::SecurityGroupEgress": new Set(["DestinationSecurityGroupName"]),
|
|
2988
|
-
"AWS::DocDB::DBCluster": new Set([
|
|
2988
|
+
"AWS::DocDB::DBCluster": new Set([
|
|
2989
|
+
"PreferredMaintenanceWindow",
|
|
2990
|
+
"PreferredBackupWindow",
|
|
2991
|
+
"EngineVersion",
|
|
2992
|
+
"KmsKeyId"
|
|
2993
|
+
]),
|
|
2989
2994
|
"AWS::DocDB::DBInstance": new Set(["PreferredMaintenanceWindow"]),
|
|
2990
2995
|
"AWS::Neptune::DBCluster": new Set([
|
|
2991
2996
|
"PreferredMaintenanceWindow",
|
|
2992
2997
|
"PreferredBackupWindow",
|
|
2993
|
-
"EngineVersion"
|
|
2998
|
+
"EngineVersion",
|
|
2999
|
+
"AvailabilityZones"
|
|
2994
3000
|
]),
|
|
2995
3001
|
"AWS::Neptune::DBInstance": new Set(["PreferredMaintenanceWindow", "AvailabilityZone"]),
|
|
2996
3002
|
"AWS::ElastiCache::CacheCluster": new Set([
|
|
@@ -3036,6 +3042,7 @@ const VALUE_INDEPENDENT_DEFAULT_TOPLEVEL_PATHS = {
|
|
|
3036
3042
|
"AWS::EC2::VPCEndpoint": new Set(["ServiceRegion", "DnsOptions"]),
|
|
3037
3043
|
"AWS::EC2::VPCPeeringConnection": new Set(["PeerRegion"]),
|
|
3038
3044
|
"AWS::EC2::VPCCidrBlock": new Set(["Ipv6CidrBlock", "Ipv6CidrBlockNetworkBorderGroup"]),
|
|
3045
|
+
"AWS::EC2::TransitGateway": new Set(["AssociationDefaultRouteTableId", "PropagationDefaultRouteTableId"]),
|
|
3039
3046
|
"AWS::Grafana::Workspace": new Set(["GrafanaVersion"]),
|
|
3040
3047
|
"AWS::Bedrock::AgentAlias": new Set(["RoutingConfiguration"]),
|
|
3041
3048
|
"AWS::AppSync::ApiKey": new Set(["Expires"]),
|
|
@@ -4016,6 +4023,40 @@ function typeChangeReplaceInfo(changed, templateResources, deployedTypeOf, stack
|
|
|
4016
4023
|
const more = changed.length > shown.length ? `, …(+${changed.length - shown.length} more)` : "";
|
|
4017
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}`;
|
|
4018
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
|
+
}
|
|
4019
4060
|
function partitionForRegion(region) {
|
|
4020
4061
|
if (region.startsWith("us-gov-")) return {
|
|
4021
4062
|
partition: "aws-us-gov",
|
|
@@ -4150,6 +4191,8 @@ async function loadDesired(client, stackName, region, templateOverride, recovery
|
|
|
4150
4191
|
if (templateOverride) {
|
|
4151
4192
|
const deletedInfo = deletedResourceInfo(physIds, template, stackName);
|
|
4152
4193
|
if (deletedInfo) console.error(deletedInfo);
|
|
4194
|
+
const noValueInfo = unpreviewableParamInfo(template, stackParams, stackName);
|
|
4195
|
+
if (noValueInfo) console.error(noValueInfo);
|
|
4153
4196
|
}
|
|
4154
4197
|
const templateResourcesForTypeCheck = template.Resources ?? {};
|
|
4155
4198
|
const typeChanged = new Set(typeChangedResources(templateResourcesForTypeCheck, deployedTypeOf));
|
|
@@ -6549,8 +6592,15 @@ async function getAllGatewayResponses(client, apiId) {
|
|
|
6549
6592
|
} while (position);
|
|
6550
6593
|
return out;
|
|
6551
6594
|
}
|
|
6595
|
+
function isBodyDefinedHttpApi(declared) {
|
|
6596
|
+
return declared.Body != null || declared.BodyS3Location != null;
|
|
6597
|
+
}
|
|
6598
|
+
function isQuickCreateHttpApi(declared) {
|
|
6599
|
+
return declared.Target != null;
|
|
6600
|
+
}
|
|
6552
6601
|
function diffApiGatewayV2Children(input) {
|
|
6553
|
-
const { apiId, declaredRouteIds, declaredIntegrationIds, liveRoutes, liveIntegrations } = input;
|
|
6602
|
+
const { apiId, declaredRouteIds, declaredIntegrationIds, liveRoutes, liveIntegrations, specMaterialized } = input;
|
|
6603
|
+
if (specMaterialized) return [];
|
|
6554
6604
|
const declaredRoutes = new Set(declaredRouteIds);
|
|
6555
6605
|
const declaredIntegrations = new Set(declaredIntegrationIds);
|
|
6556
6606
|
const added = [];
|
|
@@ -6608,7 +6658,8 @@ async function pageIntegrations(client, apiId) {
|
|
|
6608
6658
|
return out;
|
|
6609
6659
|
}
|
|
6610
6660
|
function diffApiGatewayV2Authorizers(input) {
|
|
6611
|
-
const { apiId, declaredAuthorizerIds, liveAuthorizers } = input;
|
|
6661
|
+
const { apiId, declaredAuthorizerIds, liveAuthorizers, bodyDefined } = input;
|
|
6662
|
+
if (bodyDefined) return [];
|
|
6612
6663
|
const declared = new Set(declaredAuthorizerIds);
|
|
6613
6664
|
const added = [];
|
|
6614
6665
|
for (const a of liveAuthorizers) {
|
|
@@ -6639,11 +6690,12 @@ async function pageV2Authorizers(client, apiId) {
|
|
|
6639
6690
|
return out;
|
|
6640
6691
|
}
|
|
6641
6692
|
function diffApiGatewayV2Stages(input) {
|
|
6642
|
-
const { apiId, declaredStageNames, liveStages } = input;
|
|
6693
|
+
const { apiId, declaredStageNames, liveStages, quickCreate } = input;
|
|
6643
6694
|
const declared = new Set(declaredStageNames);
|
|
6644
6695
|
const added = [];
|
|
6645
6696
|
for (const s of liveStages) {
|
|
6646
6697
|
if (declared.has(s.name)) continue;
|
|
6698
|
+
if (quickCreate && s.name === "$default") continue;
|
|
6647
6699
|
added.push({
|
|
6648
6700
|
resourceType: "AWS::ApiGatewayV2::Stage",
|
|
6649
6701
|
identifier: `${apiId}|${s.name}`,
|
|
@@ -6673,6 +6725,9 @@ async function enumerateHttpApiChildren(ctx) {
|
|
|
6673
6725
|
const { parent, desired, region } = ctx;
|
|
6674
6726
|
const apiId = parent.physicalId;
|
|
6675
6727
|
if (!apiId) return [];
|
|
6728
|
+
const bodyDefined = isBodyDefinedHttpApi(parent.declared);
|
|
6729
|
+
const quickCreate = isQuickCreateHttpApi(parent.declared);
|
|
6730
|
+
const specMaterialized = bodyDefined || quickCreate;
|
|
6676
6731
|
const declaredRouteIds = [];
|
|
6677
6732
|
const declaredIntegrationIds = [];
|
|
6678
6733
|
const declaredAuthorizerIds = [];
|
|
@@ -6715,17 +6770,20 @@ async function enumerateHttpApiChildren(ctx) {
|
|
|
6715
6770
|
declaredRouteIds,
|
|
6716
6771
|
declaredIntegrationIds,
|
|
6717
6772
|
liveRoutes,
|
|
6718
|
-
liveIntegrations
|
|
6773
|
+
liveIntegrations,
|
|
6774
|
+
specMaterialized
|
|
6719
6775
|
});
|
|
6720
6776
|
const authorizerAdded = diffApiGatewayV2Authorizers({
|
|
6721
6777
|
apiId,
|
|
6722
6778
|
declaredAuthorizerIds,
|
|
6723
|
-
liveAuthorizers
|
|
6779
|
+
liveAuthorizers,
|
|
6780
|
+
bodyDefined
|
|
6724
6781
|
});
|
|
6725
6782
|
const stageAdded = diffApiGatewayV2Stages({
|
|
6726
6783
|
apiId,
|
|
6727
6784
|
declaredStageNames,
|
|
6728
|
-
liveStages
|
|
6785
|
+
liveStages,
|
|
6786
|
+
quickCreate
|
|
6729
6787
|
});
|
|
6730
6788
|
return added.concat(authorizerAdded, stageAdded);
|
|
6731
6789
|
}
|
|
@@ -10417,7 +10475,16 @@ async function readAddedModel(cc, cfn, c, schemas, oaiCanonicalIds) {
|
|
|
10417
10475
|
};
|
|
10418
10476
|
}
|
|
10419
10477
|
}
|
|
10420
|
-
|
|
10478
|
+
function isDefinitiveNotManaged(physicalId, accountId, region) {
|
|
10479
|
+
if (!physicalId.startsWith("arn:")) return true;
|
|
10480
|
+
const seg = physicalId.split(":");
|
|
10481
|
+
const arnRegion = seg[3] ?? "";
|
|
10482
|
+
const arnAccount = seg[4] ?? "";
|
|
10483
|
+
if (arnRegion !== "" && arnRegion !== region) return false;
|
|
10484
|
+
if (arnAccount !== "" && arnAccount !== accountId) return false;
|
|
10485
|
+
return true;
|
|
10486
|
+
}
|
|
10487
|
+
async function isManagedBySiblingStack(cfn, c, cache, accountId, region) {
|
|
10421
10488
|
const physicalId = c.siblingLookupId ?? c.identifier;
|
|
10422
10489
|
if (c.siblingLookupId === void 0 && physicalId.includes("|")) return "notManaged";
|
|
10423
10490
|
const cached = cache.get(physicalId);
|
|
@@ -10446,7 +10513,7 @@ async function isManagedBySiblingStack(cfn, c, cache) {
|
|
|
10446
10513
|
}
|
|
10447
10514
|
}
|
|
10448
10515
|
} catch (e) {
|
|
10449
|
-
if (e.name === "ValidationError") {
|
|
10516
|
+
if (e.name === "ValidationError" && isDefinitiveNotManaged(physicalId, accountId, region)) {
|
|
10450
10517
|
cache.set(physicalId, "notManaged");
|
|
10451
10518
|
return "notManaged";
|
|
10452
10519
|
}
|
|
@@ -10737,7 +10804,7 @@ async function gatherFindings(stackName, region, templateOverride, recoveryTempl
|
|
|
10737
10804
|
region
|
|
10738
10805
|
});
|
|
10739
10806
|
for (const c of children) {
|
|
10740
|
-
const sibling = await isManagedBySiblingStack(cfn, c, siblingStackCache);
|
|
10807
|
+
const sibling = await isManagedBySiblingStack(cfn, c, siblingStackCache, desired.accountId, region);
|
|
10741
10808
|
if (sibling === "managed") continue;
|
|
10742
10809
|
if (sibling === "unverified") {
|
|
10743
10810
|
findings.push({
|