cdk-real-drift 0.12.46 → 0.12.48
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 +49 -28
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1359,8 +1359,14 @@ const CONTAINS_DYNAMIC_REFERENCE_RE = /\{\{resolve:(ssm|ssm-secure|secretsmanage
|
|
|
1359
1359
|
function containsDynamicReference(v) {
|
|
1360
1360
|
return CONTAINS_DYNAMIC_REFERENCE_RE.test(v);
|
|
1361
1361
|
}
|
|
1362
|
+
function containsDynamicReferenceDeep(v) {
|
|
1363
|
+
if (typeof v === "string") return containsDynamicReference(v);
|
|
1364
|
+
if (Array.isArray(v)) return v.some(containsDynamicReferenceDeep);
|
|
1365
|
+
if (v !== null && typeof v === "object") return Object.values(v).some(containsDynamicReferenceDeep);
|
|
1366
|
+
return false;
|
|
1367
|
+
}
|
|
1362
1368
|
function checkResolvedDynamicRef(r) {
|
|
1363
|
-
return
|
|
1369
|
+
return containsDynamicReferenceDeep(r) ? UNRESOLVED : r;
|
|
1364
1370
|
}
|
|
1365
1371
|
function isScalarInterpolant(v) {
|
|
1366
1372
|
const t = typeof v;
|
|
@@ -1406,11 +1412,12 @@ function resolve$1(node, ctx, inCondition = false) {
|
|
|
1406
1412
|
const [idxRaw, list] = v;
|
|
1407
1413
|
const arr = resolve$1(list, ctx);
|
|
1408
1414
|
if (!Array.isArray(arr)) return UNRESOLVED;
|
|
1415
|
+
const compacted = arr.filter((x) => x !== NOVALUE);
|
|
1409
1416
|
const idx = resolve$1(idxRaw, ctx);
|
|
1410
1417
|
if (idx === UNRESOLVED) return UNRESOLVED;
|
|
1411
1418
|
const i = Number(idx);
|
|
1412
|
-
if (!Number.isInteger(i) || i < 0 || i >=
|
|
1413
|
-
const sel =
|
|
1419
|
+
if (!Number.isInteger(i) || i < 0 || i >= compacted.length) return UNRESOLVED;
|
|
1420
|
+
const sel = compacted[i];
|
|
1414
1421
|
return sel === UNRESOLVED ? UNRESOLVED : checkResolvedDynamicRef(sel);
|
|
1415
1422
|
}
|
|
1416
1423
|
case "Fn::FindInMap": {
|
|
@@ -3828,16 +3835,7 @@ function parseIpv6Groups(addr) {
|
|
|
3828
3835
|
...tailGroups
|
|
3829
3836
|
];
|
|
3830
3837
|
}
|
|
3831
|
-
function
|
|
3832
|
-
const slash = s.indexOf("/");
|
|
3833
|
-
if (slash === -1) return void 0;
|
|
3834
|
-
const addr = s.slice(0, slash);
|
|
3835
|
-
const prefixStr = s.slice(slash + 1);
|
|
3836
|
-
if (!/^\d{1,3}$/.test(prefixStr)) return void 0;
|
|
3837
|
-
const prefix = Number.parseInt(prefixStr, 10);
|
|
3838
|
-
if (prefix < 0 || prefix > 128) return void 0;
|
|
3839
|
-
const groups = parseIpv6Groups(addr);
|
|
3840
|
-
if (!groups) return void 0;
|
|
3838
|
+
function formatCanonicalIpv6(groups) {
|
|
3841
3839
|
let bestStart = -1;
|
|
3842
3840
|
let bestLen = 0;
|
|
3843
3841
|
let curStart = -1;
|
|
@@ -3854,13 +3852,29 @@ function canonicalIpv6Cidr(s) {
|
|
|
3854
3852
|
curLen = 0;
|
|
3855
3853
|
}
|
|
3856
3854
|
const hex = groups.map((g) => g.toString(16));
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3855
|
+
if (bestLen >= 2) return `${hex.slice(0, bestStart).join(":")}::${hex.slice(bestStart + bestLen).join(":")}`;
|
|
3856
|
+
return hex.join(":");
|
|
3857
|
+
}
|
|
3858
|
+
function canonicalIpv6Cidr(s) {
|
|
3859
|
+
const slash = s.indexOf("/");
|
|
3860
|
+
if (slash === -1) return void 0;
|
|
3861
|
+
const addr = s.slice(0, slash);
|
|
3862
|
+
const prefixStr = s.slice(slash + 1);
|
|
3863
|
+
if (!/^\d{1,3}$/.test(prefixStr)) return void 0;
|
|
3864
|
+
const prefix = Number.parseInt(prefixStr, 10);
|
|
3865
|
+
if (prefix < 0 || prefix > 128) return void 0;
|
|
3866
|
+
const groups = parseIpv6Groups(addr);
|
|
3867
|
+
if (!groups) return void 0;
|
|
3868
|
+
return `${formatCanonicalIpv6(groups)}/${prefix}`;
|
|
3869
|
+
}
|
|
3870
|
+
function canonicalIpv6Address(s) {
|
|
3871
|
+
if (s.includes("/")) return void 0;
|
|
3872
|
+
const groups = parseIpv6Groups(s);
|
|
3873
|
+
if (!groups) return void 0;
|
|
3874
|
+
return formatCanonicalIpv6(groups);
|
|
3861
3875
|
}
|
|
3862
3876
|
function canonicalizeIpv6CidrsDeep(v) {
|
|
3863
|
-
if (typeof v === "string") return canonicalIpv6Cidr(v) ?? v;
|
|
3877
|
+
if (typeof v === "string") return canonicalIpv6Cidr(v) ?? canonicalIpv6Address(v) ?? v;
|
|
3864
3878
|
if (Array.isArray(v)) return v.map(canonicalizeIpv6CidrsDeep);
|
|
3865
3879
|
if (v && typeof v === "object") {
|
|
3866
3880
|
const out = {};
|
|
@@ -5446,13 +5460,12 @@ function twinOverlapEchoes(source, twin) {
|
|
|
5446
5460
|
return true;
|
|
5447
5461
|
}
|
|
5448
5462
|
function applyDefinitionSubstitutions(definitionString, substitutions) {
|
|
5449
|
-
|
|
5450
|
-
|
|
5451
|
-
|
|
5452
|
-
|
|
5453
|
-
|
|
5454
|
-
}
|
|
5455
|
-
return out;
|
|
5463
|
+
return definitionString.replace(/\$\{([^}]+)\}/g, (match, key) => {
|
|
5464
|
+
if (!(key in substitutions)) return match;
|
|
5465
|
+
const value = substitutions[key];
|
|
5466
|
+
if (value === null || typeof value === "object") return match;
|
|
5467
|
+
return String(value);
|
|
5468
|
+
});
|
|
5456
5469
|
}
|
|
5457
5470
|
const IAM_ATTACHMENT_SUBSET = { "AWS::IAM::ManagedPolicy": new Set([
|
|
5458
5471
|
"Roles",
|
|
@@ -7444,7 +7457,9 @@ function diffSnsTopicChildren(input) {
|
|
|
7444
7457
|
resourceType: "AWS::SNS::Subscription",
|
|
7445
7458
|
identifier: s.arn,
|
|
7446
7459
|
label: s.label ?? s.arn,
|
|
7447
|
-
live: { SubscriptionArn: s.arn }
|
|
7460
|
+
live: { SubscriptionArn: s.arn },
|
|
7461
|
+
ownerAccountId: s.owner,
|
|
7462
|
+
scopeArns: s.endpoint?.startsWith("arn:") ? [s.endpoint] : void 0
|
|
7448
7463
|
});
|
|
7449
7464
|
}
|
|
7450
7465
|
return added;
|
|
@@ -7476,7 +7491,8 @@ async function enumerateSnsTopicChildren(ctx) {
|
|
|
7476
7491
|
}), topicArn)).filter((s) => typeof s.SubscriptionArn === "string" && s.SubscriptionArn.startsWith("arn:")).map((s) => ({
|
|
7477
7492
|
arn: s.SubscriptionArn,
|
|
7478
7493
|
label: s.Protocol ? `${s.Protocol} ${s.Endpoint ?? ""}`.trim() : s.SubscriptionArn,
|
|
7479
|
-
endpoint: s.Endpoint
|
|
7494
|
+
endpoint: s.Endpoint,
|
|
7495
|
+
owner: s.Owner
|
|
7480
7496
|
}))
|
|
7481
7497
|
});
|
|
7482
7498
|
}
|
|
@@ -11914,6 +11930,11 @@ function isDefinitiveNotManaged(physicalId, accountId, region) {
|
|
|
11914
11930
|
if (arnAccount !== "" && arnAccount !== accountId) return false;
|
|
11915
11931
|
return true;
|
|
11916
11932
|
}
|
|
11933
|
+
function hasForeignScopeSignal(c, accountId, region) {
|
|
11934
|
+
const owner = c.ownerAccountId;
|
|
11935
|
+
if (typeof owner === "string" && owner !== "" && owner !== accountId) return true;
|
|
11936
|
+
return (c.scopeArns ?? []).some((arn) => arn.startsWith("arn:") && !isDefinitiveNotManaged(arn, accountId, region));
|
|
11937
|
+
}
|
|
11917
11938
|
async function probeSiblingPhysicalId(cfn, c, physicalId, cache, accountId, region) {
|
|
11918
11939
|
const cached = cache.get(physicalId);
|
|
11919
11940
|
if (cached !== void 0) return cached;
|
|
@@ -11941,7 +11962,7 @@ async function probeSiblingPhysicalId(cfn, c, physicalId, cache, accountId, regi
|
|
|
11941
11962
|
}
|
|
11942
11963
|
}
|
|
11943
11964
|
} catch (e) {
|
|
11944
|
-
if (e.name === "ValidationError" && isDefinitiveNotManaged(physicalId, accountId, region)) {
|
|
11965
|
+
if (e.name === "ValidationError" && isDefinitiveNotManaged(physicalId, accountId, region) && !hasForeignScopeSignal(c, accountId, region)) {
|
|
11945
11966
|
cache.set(physicalId, "notManaged");
|
|
11946
11967
|
return "notManaged";
|
|
11947
11968
|
}
|