Skip to content

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

@dcaruso-pathpoint

Description

@dcaruso-pathpoint

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/pipelinesCDK Pipelines librarybugThis issue is a bug.effort/mediumMedium work item – several days of effortgood first issueRelated to contributions. See CONTRIBUTING.mdp2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions