feat: add TerminationProtection awareness to cdk subcommand#622
Merged
feat: add TerminationProtection awareness to cdk subcommand#622
Conversation
Align delstack cdk -f behavior with cdk destroy -f by implicitly skipping the confirmation prompt when force mode is enabled.
- In interactive mode (-i), TP stacks are hidden without -f, shown with * marker when -f is used (consistent with root command) - When -f selects TP stacks, a dedicated TP confirmation prompt is shown before the general deletion confirmation - -y skips all confirmation prompts (both TP and general) - Without -f, selecting TP stacks returns TerminationProtectionError - Add CheckStack method to CloudFormationStackOperator for combined existence + TP status check - Add e2e test (cdk_termination_protection) and Makefile targets
Keep cdk.go as an orchestrator with minimal logic.
In interactive mode (-i), the checkbox "OK?" already confirms the selection, so the additional "Are you sure?" prompt is redundant. Skip it to match root command behavior.
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.
Summary
delstack cdksubcommand, consistent with root command behavior-i), TP stacks are hidden without-f, shown with*marker when-fis used-fselects TP stacks, a dedicated TP confirmation prompt is shown before the general deletion confirmation-yskips all confirmation prompts (both TP and general)-f, selecting TP stacks returnsTerminationProtectionError-i), skip the "Are you sure?" deletion confirmation (checkbox "OK?" already confirms the selection)CheckStackmethod toCloudFormationStackOperatorfor combined existence + TP status checkcdk_termination_protection) and Makefile targetsBehavior Matrix
-idelstack cdkdelstack cdk -fdelstack cdk -sdelstack cdk -s -fdelstack cdk -ydelstack cdk -f -ydelstack cdk -idelstack cdk -i -f*delstack cdk -i -f -y*Test plan
delstack cdk -i: TP stacks are not shown in selection UIdelstack cdk -i -f: TP stacks shown with*marker, TP confirmation prompt appears, no deletion confirmationdelstack cdk -i -f -y: TP stacks shown with*marker, all prompts skippeddelstack cdk -f -y: Deletes TP stacks without promptsdelstack cdkwith TP stacks: ReturnsTerminationProtectionErrordelstack cdk: Shows deletion confirmation for non-TP stacksdelstack cdk -s: Shows deletion confirmationmake e2e_cdk_termination_protection: E2E test passes