cdk-real-drift 0.9.14 → 0.10.0

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 CHANGED
@@ -376,25 +376,26 @@ CI (with `--yes`).
376
376
  leave cells natural-width. Don't chase pixel alignment at the cost of a
377
377
  readable diff. -->
378
378
 
379
- | option | meaning |
380
- | -------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
381
- | `--region <r>` | a stack's own `env.region` ALWAYS wins; for an env-AGNOSTIC stack (no `env`) it falls back to `--region` (or `$AWS_REGION` / `$AWS_DEFAULT_REGION`), else the AWS-CLI/cdk region chain — the active profile's region, then the `[default]` profile's region, then EC2 IMDS |
382
- | `--profile <p>` | AWS profile (else `$AWS_PROFILE`, else `$AWS_DEFAULT_PROFILE` — same order `aws` and `cdk` use) |
383
- | `-a, --app <cmd\|cdk.out>` | CDK app command or pre-synthesized assembly dir (or `$CDKRD_APP` / cdk.json `"app"`); stack auto-discovery + construct paths |
384
- | `-c, --context key=value` | context for synth (repeatable; cdk.json is the base layer) |
385
- | `--all` | target every stack the app defines (the default when no `<stack>` is named; overrides any positional names) |
386
- | `--json` | machine-readable output (see [JSON contract](#json-output-contract)) |
387
- | `--fail` | (check) exit 1 on drift and never prompt; for scripts/CI. Without it, check reports drift but exits 0 |
388
- | `--strict` | (check) exit 1 when coverage is incomplete. A coverage gap is always surfaced loudly; `--strict` makes it CI-failing. Orthogonal to `--fail` |
389
- | `--show-all` | (check) inventory mode: show all current undeclared state, ignoring the baseline |
390
- | `--verbose` / `-v` | (check) expand the `info:` footer tiers / (revert) expand the not-revertable summary to full lists; (record) itemizes nested sub-keys in the multiselect. `-v` means `--verbose` **inside a verb** (`check -v`); a bare `cdkrd -v` (no verb) prints the version |
391
- | `--pre-deploy` | (check) compare live vs the LOCAL synth template: the declared drift your next `cdk deploy` would silently overwrite |
392
- | `--undeclared-only` | (check) undeclared drift only: pair cdkrd with `cdk drift` for the declared side |
393
- | `--declared-only` | (check) declared drift vs the deployed template only (undeclared tier skipped; baseline untouched). Not `--pre-deploy` |
394
- | `--dry-run` | (revert) print the plan; make no changes |
395
- | `--wait[=DURATION]` | (revert) on a transient "resource is mid-update" error (e.g. Route53Resolver `RSLVR-00705`) keep retrying until it settles, up to DURATION (default `10m`; e.g. `--wait=5m`, `--wait=90s`). The DURATION is **inline-only** (`--wait=5m`); a separate `--wait 5m` is not read |
396
- | `--remove-unrecorded` | (revert, and check for its inline revert) REMOVE unrecorded values + DELETE unrecorded added resources in a no-prompt run (`--yes`/CI); an interactive revert already lists them |
397
- | `--yes` / `-y` | skip confirmations (revert apply; record records all without the multiselect) |
379
+ | option | meaning |
380
+ | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
381
+ | `--region <r>` | a stack's own `env.region` ALWAYS wins; for an env-AGNOSTIC stack (no `env`) it falls back to `--region` (or `$AWS_REGION` / `$AWS_DEFAULT_REGION`), else the AWS-CLI/cdk region chain — the active profile's region, then the `[default]` profile's region, then EC2 IMDS |
382
+ | `--profile <p>` | AWS profile (else `$AWS_PROFILE`, else `$AWS_DEFAULT_PROFILE` — same order `aws` and `cdk` use) |
383
+ | `-a, --app <cmd\|cdk.out>` | CDK app command or pre-synthesized assembly dir (or `$CDKRD_APP` / cdk.json `"app"`); stack auto-discovery + construct paths |
384
+ | `-c, --context key=value` | context for synth (repeatable; cdk.json is the base layer) |
385
+ | `--all` | target every stack the app defines (the default when no `<stack>` is named; overrides any positional names) |
386
+ | `--json` | machine-readable output (see [JSON contract](#json-output-contract)) |
387
+ | `--fail` | (check) exit 1 on drift and never prompt; for scripts/CI. Without it, check reports drift but exits 0 |
388
+ | `--strict` | (check) exit 1 when coverage is incomplete. A coverage gap is always surfaced loudly; `--strict` makes it CI-failing. Orthogonal to `--fail` |
389
+ | `--show-all` | (check) inventory mode: show all current undeclared state, ignoring the baseline |
390
+ | `--verbose` / `-v` | (check) expand the `info:` footer tiers / (revert) expand the not-revertable summary to full lists; (record) itemizes nested sub-keys in the multiselect. `-v` means `--verbose` **inside a verb** (`check -v`); a bare `cdkrd -v` (no verb) prints the version |
391
+ | `--pre-deploy` | (check) compare live vs the LOCAL synth template: the declared drift your next `cdk deploy` would silently overwrite |
392
+ | `--undeclared-only` | (check) undeclared drift only: pair cdkrd with `cdk drift` for the declared side |
393
+ | `--declared-only` | (check) declared drift vs the deployed template only (undeclared tier skipped; baseline untouched). Not `--pre-deploy` |
394
+ | `--dry-run` | (revert) print the plan; make no changes |
395
+ | `--wait[=DURATION]` | (revert) on a transient "resource is mid-update" error (e.g. Route53Resolver `RSLVR-00705`) keep retrying until it settles, up to DURATION (default `10m`; e.g. `--wait=5m`, `--wait=90s`). The DURATION is **inline-only** (`--wait=5m`); a separate `--wait 5m` is not read |
396
+ | `--remove-unrecorded` | (revert, and check for its inline revert) REMOVE unrecorded values + DELETE unrecorded added resources in a no-prompt run (`--yes`/CI); an interactive revert already lists them |
397
+ | `--force` | (revert) proceed even when the stack is **mid-operation** (`*_IN_PROGRESS`). By default revert re-reads the stack right before the write and refuses (to avoid fighting an in-flight deploy); `--force` overrides that for a knowingly-wedged stack. The mid-operation warning still prints; `--force` does **not** skip the confirm (that is `--yes`) |
398
+ | `--yes` / `-y` | skip confirmations (revert apply; record records all without the multiselect) |
398
399
 
399
400
  Unknown options (`--apq`) and options missing their value (`--app` at the end of
400
401
  the line) are errors (exit `2`): a typo'd flag never silently becomes a stack name.
@@ -729,7 +730,10 @@ After publication this shape is a backward-compatible API.
729
730
  `revert` also **refuses to write (exit 2) when the target stack is mid-operation**
730
731
  (`*_IN_PROGRESS`): it re-reads the stack status immediately before applying, so a
731
732
  revert can never fight an in-flight `cdk deploy` / update by writing stale values
732
- onto an updating stack — wait for the stack to settle, then re-run. And
733
+ onto an updating stack — wait for the stack to settle, then re-run. For a stack
734
+ that is **wedged** in an `*_IN_PROGRESS` state that will never settle, pass
735
+ `--force` to override the refusal (the mid-operation warning still prints; `--force`
736
+ only skips this in-progress refusal — not the confirm, which is `--yes`). And
733
737
  `record` / `ignore` / `revert` now surface the same stack-status warning `check`
734
738
  prints when a stack is mid-operation or in a failed state (a `record` mid-update
735
739
  would otherwise snapshot transient values into the committed baseline).
package/dist/cli.js CHANGED
@@ -293,6 +293,7 @@ const BOOLEAN_FLAGS = new Set([
293
293
  "--declared-only",
294
294
  "--dry-run",
295
295
  "--remove-unrecorded",
296
+ "--force",
296
297
  "--verbose",
297
298
  "-v",
298
299
  "--strict",
@@ -333,7 +334,8 @@ const ALLOWED_FLAGS_BY_VERB = {
333
334
  "--verbose",
334
335
  "--remove-unrecorded",
335
336
  "--dry-run",
336
- "--wait"
337
+ "--wait",
338
+ "--force"
337
339
  ])
338
340
  };
339
341
  /**
@@ -428,6 +430,7 @@ function parseCommonArgs(args, verb) {
428
430
  undeclaredOnly: has("--undeclared-only"),
429
431
  declaredOnly: has("--declared-only"),
430
432
  removeUnrecorded: has("--remove-unrecorded"),
433
+ force: has("--force"),
431
434
  verbose: has("--verbose") || has("-v"),
432
435
  waitMs
433
436
  };
@@ -15264,7 +15267,7 @@ function augmentRevertPlan(plan, schemas, liveByLogical, declaredByLogical) {
15264
15267
  };
15265
15268
  }
15266
15269
  async function revertStack(p) {
15267
- const { stackName, region, gathered, baseline, config, dryRun, yes, removeUnrecorded, verbose, interactive, autoSelectAll, selectedFindingKeys, waitMs, waitNow, waitSleep } = p;
15270
+ const { stackName, region, gathered, baseline, config, dryRun, yes, removeUnrecorded, force, verbose, interactive, autoSelectAll, selectedFindingKeys, waitMs, waitNow, waitSleep } = p;
15268
15271
  const out = p.json ? () => {} : console.log;
15269
15272
  let worst = 0;
15270
15273
  const includeRemovals = includeUnrecordedRemovals(removeUnrecorded, interactive, yes);
@@ -15371,7 +15374,8 @@ async function revertStack(p) {
15371
15374
  }
15372
15375
  plan = augment(plan);
15373
15376
  const inProgress = await stackInProgressRefusal(stackName, region);
15374
- if (inProgress) {
15377
+ if (inProgress) if (force) console.error("\nwarning: " + inProgress + " Proceeding anyway (--force).");
15378
+ else {
15375
15379
  console.error("\n" + inProgress);
15376
15380
  return {
15377
15381
  exit: 2,
@@ -17147,6 +17151,7 @@ async function runRevert(args) {
17147
17151
  dryRun,
17148
17152
  yes: a.yes,
17149
17153
  removeUnrecorded: a.removeUnrecorded,
17154
+ force: a.force,
17150
17155
  verbose: a.verbose,
17151
17156
  interactive: a.json ? false : isInteractive(),
17152
17157
  ...a.waitMs !== void 0 && { waitMs: a.waitMs },
@@ -17273,6 +17278,12 @@ OPTIONS
17273
17278
  --remove-unrecorded (revert, and check for its inline revert) REMOVE unrecorded
17274
17279
  values + DELETE unrecorded added resources (never recorded;
17275
17280
  default: refuse — record the ones that are right)
17281
+ --force (revert) proceed even when the stack is mid-operation
17282
+ (*_IN_PROGRESS). By default revert re-reads the stack right
17283
+ before the write and REFUSES, to avoid fighting an in-flight
17284
+ deploy; --force overrides that for a knowingly-wedged stack
17285
+ (the mid-operation warning still prints; --force does NOT
17286
+ skip the confirm — that is --yes)
17276
17287
  --yes, -y skip the write confirm AND the op multiselect — apply the
17277
17288
  FULL plan (revert) / skip the selection multiselect +
17278
17289
  overwrite notice, record ALL (record) / ignore ALL shown