Skip to content

feat: check and disable resource deletion protection before stack deletion#581

Merged
go-to-k merged 8 commits intomainfrom
del-protection
Mar 14, 2026
Merged

feat: check and disable resource deletion protection before stack deletion#581
go-to-k merged 8 commits intomainfrom
del-protection

Conversation

@go-to-k
Copy link
Copy Markdown
Owner

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

Summary

Closes #475

  • Add pre-deletion check for resource-level deletion/termination protection (EC2, RDS DBInstance/DBCluster, Cognito UserPool, CloudWatch LogGroup, ELBv2 LoadBalancer)
  • Without -f: detect protected resources and abort with an error listing them
  • With -f: automatically disable protection via AWS API, then proceed with deletion
  • Restructure CompositePreprocessor into 2-phase execution (checkers → modifiers) to ensure protection checks run before modifications like Lambda VPC detach

Changes

  • New clients: pkg/client/rds.go, cognito.go, cloudwatchlogs.go, elbv2.go + EC2 client extension
  • New preprocessor: DeletionProtectionRemover as a checker in CompositePreprocessor
  • CompositePreprocessor: split into checkers (fatal errors) and modifiers (warning-only errors)
  • RecursivePreprocessor: switch from WaitGroup to errgroup for error propagation
  • E2E test environment: testdata_deletion_protection/ with CDK stack

@go-to-k go-to-k marked this pull request as ready for review March 14, 2026 11:39
@go-to-k go-to-k merged commit 332cf9b into main Mar 14, 2026
5 checks passed
@go-to-k go-to-k deleted the del-protection branch March 14, 2026 13:05
This was referenced Mar 14, 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.

[Feature] Check resource's deletion (terminate) protection before stack deletion

1 participant