aws/aws-cdk

(cdk pipelines): cdk pipeline support stacks should delete and not orphan s3 buckets

Open

#35654 opened on Oct 1, 2025

View on GitHub
 (1 comment) (0 reactions) (0 assignees)TypeScript (10,710 stars) (3,530 forks)batch import
@aws-cdk/pipelinesbugeffort/mediumgood first issuep2

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