cdk-real-drift 0.12.11 → 0.12.12
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 +37 -2
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -4444,6 +4444,8 @@ async function loadDesired(client, stackName, region, templateOverride, recovery
|
|
|
4444
4444
|
const rawTemplate = templateOverride ? JSON.stringify(templateOverride) : tmplRes.TemplateBody ?? "{}";
|
|
4445
4445
|
const stackId = stack?.StackId ?? "";
|
|
4446
4446
|
const accountId = stackId.split(":")[4] ?? "";
|
|
4447
|
+
const stackTags = {};
|
|
4448
|
+
for (const t of stack?.Tags ?? []) if (typeof t.Key === "string" && typeof t.Value === "string") stackTags[t.Key] = t.Value;
|
|
4447
4449
|
const stackParams = {};
|
|
4448
4450
|
for (const p of stack?.Parameters ?? []) {
|
|
4449
4451
|
if (!p.ParameterKey) continue;
|
|
@@ -4510,6 +4512,7 @@ async function loadDesired(client, stackName, region, templateOverride, recovery
|
|
|
4510
4512
|
region,
|
|
4511
4513
|
accountId,
|
|
4512
4514
|
resources,
|
|
4515
|
+
stackTags,
|
|
4513
4516
|
rawTemplate,
|
|
4514
4517
|
ctx,
|
|
4515
4518
|
stackStatusWarning
|
|
@@ -5011,6 +5014,36 @@ function canonicalizeBaselineForCompare(v, resourceType) {
|
|
|
5011
5014
|
return sortObjectArraysDeep(canonicalizeForCompare(stripAwsTagsDeep(stripCcApiAwsManagedFields(v)), resourceType));
|
|
5012
5015
|
}
|
|
5013
5016
|
|
|
5017
|
+
//#endregion
|
|
5018
|
+
//#region src/normalize/stack-tags.ts
|
|
5019
|
+
const declaredTagKeys = (declared) => {
|
|
5020
|
+
const out = /* @__PURE__ */ new Set();
|
|
5021
|
+
const tags = declared?.Tags;
|
|
5022
|
+
if (Array.isArray(tags)) for (const t of tags) {
|
|
5023
|
+
const k = t?.Key;
|
|
5024
|
+
if (typeof k === "string") out.add(k);
|
|
5025
|
+
}
|
|
5026
|
+
return out;
|
|
5027
|
+
};
|
|
5028
|
+
const subtractPropagatedStackTags = (live, stackTags, declaredKeys) => {
|
|
5029
|
+
if (Object.keys(stackTags).length === 0) return live;
|
|
5030
|
+
const tags = live.Tags;
|
|
5031
|
+
if (!Array.isArray(tags)) return live;
|
|
5032
|
+
const filtered = tags.filter((t) => {
|
|
5033
|
+
if (!t || typeof t !== "object") return true;
|
|
5034
|
+
const key = t.Key;
|
|
5035
|
+
const value = t.Value;
|
|
5036
|
+
if (typeof key !== "string") return true;
|
|
5037
|
+
if (declaredKeys.has(key)) return true;
|
|
5038
|
+
return !(key in stackTags && stackTags[key] === value);
|
|
5039
|
+
});
|
|
5040
|
+
if (filtered.length === tags.length) return live;
|
|
5041
|
+
return {
|
|
5042
|
+
...live,
|
|
5043
|
+
Tags: filtered
|
|
5044
|
+
};
|
|
5045
|
+
};
|
|
5046
|
+
|
|
5014
5047
|
//#endregion
|
|
5015
5048
|
//#region src/diff/drift-calculator.ts
|
|
5016
5049
|
function calculateResourceDrift(stateProperties, awsProperties, options) {
|
|
@@ -5650,10 +5683,10 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
|
|
|
5650
5683
|
const liveForCompare = structuredClone(liveRaw);
|
|
5651
5684
|
const declaredForCompare = cloneDeepWithSymbols(declaredIn);
|
|
5652
5685
|
stripAsymmetricIdentityFields(declaredForCompare, liveForCompare);
|
|
5653
|
-
const live = normalizeLiveModel(liveForCompare, schema, {
|
|
5686
|
+
const live = subtractPropagatedStackTags(normalizeLiveModel(liveForCompare, schema, {
|
|
5654
5687
|
oaiCanonicalIds: oaiMap,
|
|
5655
5688
|
resourceType
|
|
5656
|
-
});
|
|
5689
|
+
}), opts.stackTags ?? {}, declaredTagKeys(declaredForCompare));
|
|
5657
5690
|
const declared = canonicalizeForCompare(rewriteOaiPrincipalsDeep(declaredForCompare, oaiMap), resourceType);
|
|
5658
5691
|
const reflected = REFLECTED_CHILD_PROPS[resourceType];
|
|
5659
5692
|
if (reflected && !(reflected in declared)) delete live[reflected];
|
|
@@ -11686,6 +11719,7 @@ async function gatherFindings(stackName, region, templateOverride, recoveryTempl
|
|
|
11686
11719
|
region,
|
|
11687
11720
|
kmsAliasTargets,
|
|
11688
11721
|
defaultSgIds,
|
|
11722
|
+
stackTags: desired.stackTags,
|
|
11689
11723
|
oaiCanonicalIds,
|
|
11690
11724
|
siblingSgRules: buildSiblingSgRules(desired),
|
|
11691
11725
|
siblingEventBusPolicies: buildSiblingEventBusPolicies(desired),
|
|
@@ -11755,6 +11789,7 @@ async function regatherTouched(gathered, touched, region) {
|
|
|
11755
11789
|
region,
|
|
11756
11790
|
kmsAliasTargets,
|
|
11757
11791
|
defaultSgIds,
|
|
11792
|
+
stackTags: desired.stackTags,
|
|
11758
11793
|
oaiCanonicalIds,
|
|
11759
11794
|
siblingSgRules: buildSiblingSgRules(desired),
|
|
11760
11795
|
siblingEventBusPolicies: buildSiblingEventBusPolicies(desired),
|