(cdk pipelines): cdk pipeline support stacks should delete and not orphan s3 buckets
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
### Describe the bug
When using CDK pipelines to deploy preview environments it is very important that a CDK destroy actually cleans up all of the resources.
This bucket https://github.com/aws/aws-cdk/blob/fdb4ddb446d3c17088d81104191d6688ca4ce721/packages/aws-cdk-lib/aws-codepipeline/lib/private/cross-region-support-stack.ts#L79C10-L79C27
Does not have a resource policy or autodeleteobjects set.
It would be nice if the CDK was better written to allow for stack destroys and recreates.
### Regression Issue
- [ ] Select this option if this issue appears to be a regression.
### Last Known Working CDK Library Version
_No response_
### Expected Behavior
When running cdk destroy you are able to set resource policies so that if you are using the cdk to deploy preview environments you have clean teardowns.
### Current Behavior
the mentioned bucket is orphaned and if you try to redeploy your app it fails
### Reproduction Steps
create a cross region cdk pipeline
### Possible Solution
allow us to define the resource policy
### Additional Information/Context
_No response_
### AWS CDK Library version (aws-cdk-lib)
latest
### AWS CDK CLI version
latest
### Node.js Version
24
### OS
mac
### Language
TypeScript
### Language Version
_No response_
### Other information
_No response_
Contributor guide
Research direction
Start in packages/aws-cdk-lib/aws-codepipeline/lib/private/cross-region-support-stack.ts at the support bucket mentioned in the issue. Reproduce a cross-region CDK pipeline, run cdk destroy, and inspect whether the bucket is orphaned; done means the support resources can be cleaned up and a preview environment can be redeployed successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- cloud, devops, infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100