cdk-real-drift 0.2.57 → 0.2.58
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 +23 -8
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -13452,19 +13452,30 @@ function nestedStackWarning(resources, stackName) {
|
|
|
13452
13452
|
const names = nested.map((r) => r.constructPath ? withinStackPath(r.constructPath, stackName) : r.logicalId).sort();
|
|
13453
13453
|
return `warning: ${stackName} has ${nested.length} nested CloudFormation stack(s) — cdkrd does not recurse into them, so the resources INSIDE them are NOT checked: ${names.join(", ")}`;
|
|
13454
13454
|
}
|
|
13455
|
-
function
|
|
13456
|
-
|
|
13455
|
+
function isPendingCreationSkip(f) {
|
|
13456
|
+
return f.tier === "skipped" && f.note === "no physical id";
|
|
13457
|
+
}
|
|
13458
|
+
function coverageWarning(findings, stackName, preDeploy = false) {
|
|
13459
|
+
const skipped = findings.filter((f) => f.tier === "skipped" && !(preDeploy && isPendingCreationSkip(f)));
|
|
13457
13460
|
if (skipped.length === 0) return null;
|
|
13458
13461
|
const names = skipped.map((f) => f.constructPath ? withinStackPath(f.constructPath, stackName) : f.logicalId).sort();
|
|
13459
13462
|
const shown = names.slice(0, 10);
|
|
13460
13463
|
const more = names.length > shown.length ? `, …(+${names.length - shown.length} more)` : "";
|
|
13461
13464
|
return `warning: ${stackName}: ${skipped.length} resource(s) were NOT checked (coverage incomplete) — ${shown.join(", ")}${more}; see the skipped breakdown (--verbose)`;
|
|
13462
13465
|
}
|
|
13463
|
-
function
|
|
13464
|
-
|
|
13466
|
+
function pendingCreationInfo(findings, stackName) {
|
|
13467
|
+
const pending = findings.filter(isPendingCreationSkip);
|
|
13468
|
+
if (pending.length === 0) return null;
|
|
13469
|
+
const names = pending.map((f) => f.constructPath ? withinStackPath(f.constructPath, stackName) : f.logicalId).sort();
|
|
13470
|
+
const shown = names.slice(0, 10);
|
|
13471
|
+
const more = names.length > shown.length ? `, …(+${names.length - shown.length} more)` : "";
|
|
13472
|
+
return `info: ${stackName}: ${pending.length} resource(s) not yet deployed — will be created by the next deploy (pending creation, not a coverage gap): ${shown.join(", ")}${more}`;
|
|
13473
|
+
}
|
|
13474
|
+
function hasCoverageGap(findings, resources, preDeploy = false) {
|
|
13475
|
+
return findings.some((f) => f.tier === "skipped" && !(preDeploy && isPendingCreationSkip(f))) || resources.some((r) => r.resourceType === "AWS::CloudFormation::Stack");
|
|
13465
13476
|
}
|
|
13466
|
-
function strictCoverageExit(strict, findings, resources) {
|
|
13467
|
-
return strict && hasCoverageGap(findings, resources) ? 1 : 0;
|
|
13477
|
+
function strictCoverageExit(strict, findings, resources, preDeploy = false) {
|
|
13478
|
+
return strict && hasCoverageGap(findings, resources, preDeploy) ? 1 : 0;
|
|
13468
13479
|
}
|
|
13469
13480
|
/**
|
|
13470
13481
|
* Map a stack's drift code to check's final exit (R53, the `cdk diff --fail` /
|
|
@@ -13571,9 +13582,13 @@ async function runCheck(args) {
|
|
|
13571
13582
|
const nestedWarn = nestedStackWarning(desired.resources, stackName);
|
|
13572
13583
|
if (nestedWarn) console.error(nestedWarn);
|
|
13573
13584
|
if (a.json) {
|
|
13574
|
-
const covWarn = coverageWarning(gathered.findings, stackName);
|
|
13585
|
+
const covWarn = coverageWarning(gathered.findings, stackName, a.preDeploy);
|
|
13575
13586
|
if (covWarn) console.error(covWarn);
|
|
13576
13587
|
}
|
|
13588
|
+
if (a.preDeploy) {
|
|
13589
|
+
const pendingInfo = pendingCreationInfo(gathered.findings, stackName);
|
|
13590
|
+
if (pendingInfo) console.error(pendingInfo);
|
|
13591
|
+
}
|
|
13577
13592
|
if (desired.stackStatusWarning) console.error(`warning: ${stackName}: ${desired.stackStatusWarning}`);
|
|
13578
13593
|
if (a.undeclaredOnly) {
|
|
13579
13594
|
findings = undeclaredOnlyFindings(findings);
|
|
@@ -13601,7 +13616,7 @@ async function runCheck(args) {
|
|
|
13601
13616
|
} else preDeployCode = report(preDeployReconciled, preDeployHeader, { verbose: a.verbose });
|
|
13602
13617
|
if (preDeployCode === 1) anyDrift = true;
|
|
13603
13618
|
worst = Math.max(worst, finalCheckExit(preDeployCode, a.fail));
|
|
13604
|
-
worst = Math.max(worst, strictCoverageExit(a.strict, gathered.findings, desired.resources));
|
|
13619
|
+
worst = Math.max(worst, strictCoverageExit(a.strict, gathered.findings, desired.resources, true));
|
|
13605
13620
|
continue;
|
|
13606
13621
|
}
|
|
13607
13622
|
const baseline = a.showAll ? void 0 : await loadBaseline(stackName, desired.accountId, region);
|