cdk diff adds --fail-on destructive
Introduced 2026-10-08 · score 0.98
HOW TO USE IT
When reviewing a proposed stack update, run `cdk diff --fail-on=destructive <StackName>` to exit with code 1 if a change would replace, delete, or orphan an existing resource. In-place updates and new resources do not trigger failure.
cdk diff --fail-on=destructive <StackName>WHY THIS HELPS
Configure `cdk diff` to fail on destructive changes when reviewing a proposed stack update.
REQUIREMENTS AND LIMITATIONS
- Version: 2.1145.0
- --fail-on=destructive: Fail with exit code 1 only if changes replace, delete, or orphan an existing resource; in-place updates and additions do not cause failure.
- <StackName>: Optional stack name to diff; without it the CLI diffs the app's stacks.
- Prerequisite: Requires Node.js or another JavaScript runtime; minimum supported Node.js version is v18.
FIRST-PARTY EVIDENCE
- https://github.com/aws/aws-cdk-cli/releases/tag/aws-cdk%40v2.1145.0
- https://github.com/aws/aws-cdk-cli/blob/fba21bbf3650ef10ef828b29df51d31bf86a9966/packages/aws-cdk/README.md
Check the installed version and the source before using it. Entry JSON