feat(cli): add cdk deploy --method=execute-change-set for two-step deployment workflows#1271
Draft
feat(cli): add cdk deploy --method=execute-change-set for two-step deployment workflows#1271
cdk deploy --method=execute-change-set for two-step deployment workflows#1271Conversation
82a7fbd to
309f84e
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1271 +/- ##
==========================================
- Coverage 88.11% 87.96% -0.15%
==========================================
Files 73 73
Lines 10359 10398 +39
Branches 1410 1421 +11
==========================================
+ Hits 9128 9147 +19
- Misses 1204 1223 +19
- Partials 27 28 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…ts\n\nInstead of short-circuiting in cli.ts, the execute-change-set method\nnow flows through the normal deploy path:\n\n- cli.ts -> CdkToolkit.deploy() -> Toolkit.executeChangeSet()\n- Toolkit.deploy() intercepts execute-change-set before synth\n- CdkToolkit.deploy() intercepts before stack selection\n- determineDeploymentMethod() handles validation and returns the type\n- deployStack guard updated to indicate a bug, not user error
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #801
This adds a new
--method=execute-change-setoption tocdk deploythat enables a two-step deployment workflow where users first create a change set for review, then explicitly execute it after inspection.The motivation comes from users who want to verify exactly what CloudFormation will do before committing to a deployment. While
cdk diffinfers changes from templates, an actual change set created by CloudFormation is the source of truth for what will happen. This is especially important for stateful resources where accidental replacements can cause data loss.The intended workflow is:
The
execute-change-setmethod bypasses synthesis and stack selection entirely since the change set already exists in CloudFormation. In the CLI, this short-circuits directly to toolkit-lib rather than adding a new branch toCdkToolkit, keeping the existing deploy flow untouched. The method requires--change-set-nameand exactly one stack name. Options that only apply during change set creation (like--force,--parameters,--no-rollback,--import-existing-resources,--revert-drift) are ignored with a warning when used with this method.On the toolkit-lib side, a new
ExecuteChangeSetDeploymenttype is added to theDeploymentMethodunion, and a newToolkit.executeChangeSet()method handles the execution by working directly with CloudFormation APIs without requiring a cloud assembly.Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license