Skip to content

feat: add TerminationProtection awareness to cdk subcommand#622

Merged
go-to-k merged 9 commits intomainfrom
feat/cdk-force-skip-confirmation
Mar 31, 2026
Merged

feat: add TerminationProtection awareness to cdk subcommand#622
go-to-k merged 9 commits intomainfrom
feat/cdk-force-skip-confirmation

Conversation

@go-to-k
Copy link
Copy Markdown
Owner

@go-to-k go-to-k commented Mar 31, 2026

Summary

  • Add TerminationProtection (TP) awareness to delstack cdk subcommand, consistent with root command behavior
  • In interactive mode (-i), TP stacks are hidden without -f, shown with * marker when -f is used
  • 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
  • In interactive mode (-i), skip the "Are you sure?" deletion confirmation (checkbox "OK?" already confirms the selection)
  • Add CheckStack method to CloudFormationStackOperator for combined existence + TP status check
  • Add e2e test (cdk_termination_protection) and Makefile targets

Behavior Matrix

Command TP stacks in -i TP confirmation Deletion confirmation
delstack cdk N/A Error if TP stacks included Shown
delstack cdk -f N/A Shown Shown
delstack cdk -s N/A Error if TP stacks included Shown
delstack cdk -s -f N/A Shown Shown
delstack cdk -y N/A Error if TP stacks included Skipped
delstack cdk -f -y N/A Skipped Skipped
delstack cdk -i Hidden N/A Skipped (checkbox "OK?" suffices)
delstack cdk -i -f Shown with * Shown Skipped (checkbox "OK?" suffices)
delstack cdk -i -f -y Shown with * Skipped Skipped

Test plan

  • delstack cdk -i: TP stacks are not shown in selection UI
  • delstack cdk -i -f: TP stacks shown with * marker, TP confirmation prompt appears, no deletion confirmation
  • delstack cdk -i -f -y: TP stacks shown with * marker, all prompts skipped
  • delstack cdk -f -y: Deletes TP stacks without prompts
  • delstack cdk with TP stacks: Returns TerminationProtectionError
  • delstack cdk: Shows deletion confirmation for non-TP stacks
  • delstack cdk -s: Shows deletion confirmation
  • Existing unit tests pass
  • make e2e_cdk_termination_protection: E2E test passes

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
@go-to-k go-to-k changed the title feat: make -f flag skip confirmation prompt in cdk subcommand feat: add TerminationProtection awareness to cdk subcommand Mar 31, 2026
@go-to-k go-to-k merged commit a099394 into main Mar 31, 2026
20 checks passed
@go-to-k go-to-k deleted the feat/cdk-force-skip-confirmation branch March 31, 2026 07:35
@github-actions github-actions bot mentioned this pull request Mar 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant