cdk-real-drift 0.12.52 → 0.12.53
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 +6 -0
- package/dist/cli.js +25 -0
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -487,6 +487,12 @@ before deploying. As a pipeline gate:
|
|
|
487
487
|
`--pre-deploy` reports **declared** drift only (the undeclared tier is defined
|
|
488
488
|
against the _deployed_ template) and never touches the baseline.
|
|
489
489
|
|
|
490
|
+
One caveat on template **parameters**: for an existing parameter a plain
|
|
491
|
+
`cdk deploy` keeps the deployed value (`UsePreviousValue`), so drift previewed
|
|
492
|
+
from a **changed local `Default`** is applied only if you pass
|
|
493
|
+
`--parameters <key>=<value>` / `--no-previous-parameters` — `check` prints a
|
|
494
|
+
stderr note naming each such parameter and both values.
|
|
495
|
+
|
|
490
496
|
### Ignoring externally-managed properties
|
|
491
497
|
|
|
492
498
|
Some properties are _legitimately_ rewritten by another system, such as Application
|
package/dist/cli.js
CHANGED
|
@@ -4466,6 +4466,29 @@ function unpreviewableParamInfo(template, stackParams, stackName) {
|
|
|
4466
4466
|
const more = unpreviewable.length > shown.length ? `, …(+${unpreviewable.length - shown.length} more)` : "";
|
|
4467
4467
|
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}`;
|
|
4468
4468
|
}
|
|
4469
|
+
function changedDefaultParamInfo(template, stackParams, stackName) {
|
|
4470
|
+
const paramDefs = template.Parameters ?? {};
|
|
4471
|
+
const normalize = (k, v) => {
|
|
4472
|
+
const t = paramDefs[k]?.Type ?? "";
|
|
4473
|
+
if (t !== "CommaDelimitedList" && !t.startsWith("List<")) return v;
|
|
4474
|
+
return v.split(",").map((s) => s.trim()).join(",");
|
|
4475
|
+
};
|
|
4476
|
+
const changed = Object.entries(paramDefs).filter(([k, def]) => {
|
|
4477
|
+
if (def?.NoEcho === true || def?.NoEcho === "true") return false;
|
|
4478
|
+
if ((def?.Type ?? "").includes("::Parameter::Value<")) return false;
|
|
4479
|
+
if (!def || !("Default" in def)) return false;
|
|
4480
|
+
if (!(k in stackParams)) return false;
|
|
4481
|
+
return normalize(k, String(def.Default)) !== normalize(k, stackParams[k] ?? "");
|
|
4482
|
+
}).map(([k]) => k);
|
|
4483
|
+
if (changed.length === 0) return null;
|
|
4484
|
+
const referenced = collectReferencedNames(template.Resources ?? {});
|
|
4485
|
+
collectReferencedNames(template.Conditions ?? {}, referenced);
|
|
4486
|
+
const diverged = changed.filter((k) => referenced.has(k)).sort();
|
|
4487
|
+
if (diverged.length === 0) return null;
|
|
4488
|
+
const shown = diverged.slice(0, 10).map((k) => `${k} (local Default ${JSON.stringify(String(paramDefs[k]?.Default))}, deployed ${JSON.stringify(stackParams[k])})`);
|
|
4489
|
+
const more = diverged.length > shown.length ? `, …(+${diverged.length - shown.length} more)` : "";
|
|
4490
|
+
return `warning: ${stackName}: ${diverged.length} local parameter(s) changed their Default vs the deployed value — the preview resolves them from the NEW local Default, but a plain \`cdk deploy\` KEEPS the deployed value (UsePreviousValue) unless \`--parameters <key>=<value>\` / \`--no-previous-parameters\` is passed: ${shown.join(", ")}${more}`;
|
|
4491
|
+
}
|
|
4469
4492
|
function partitionForRegion(region) {
|
|
4470
4493
|
if (region.startsWith("us-gov-")) return {
|
|
4471
4494
|
partition: "aws-us-gov",
|
|
@@ -4667,6 +4690,8 @@ async function loadDesired(client, stackName, region, templateOverride, recovery
|
|
|
4667
4690
|
if (deletedInfo) console.error(deletedInfo);
|
|
4668
4691
|
const noValueInfo = unpreviewableParamInfo(template, stackParams, stackName);
|
|
4669
4692
|
if (noValueInfo) console.error(noValueInfo);
|
|
4693
|
+
const changedDefaultInfo = changedDefaultParamInfo(template, stackParams, stackName);
|
|
4694
|
+
if (changedDefaultInfo) console.error(changedDefaultInfo);
|
|
4670
4695
|
}
|
|
4671
4696
|
const templateResourcesForTypeCheck = template.Resources ?? {};
|
|
4672
4697
|
const typeChanged = new Set(typeChangedResources(templateResourcesForTypeCheck, deployedTypeOf));
|