Skip to content

(aws-s3): Allow setting autoDeleteObjects on existing Buckets #15413

@Gtofig

Description

@Gtofig

Allow setting autoDeleteObjects property of Bucket construct outside constructor.

Use Case

Buckets are often created as part of other constructs (ex: CodePipeline, CDKPipeline, Canary, etc), so developer doesn't always get to control props passed to constructor. In test or transient environments, I don't want any buckets to linger after stack is deleted. As a developer I could work around that by writing an Aspect that finds all instances of Bucket and setting autoDeleteObjects to true (as well as RemovalPolicy to DESTROY). However, at the moment it is not possible, as this property is not exposed outside constructor props.

Proposed Solution

Make enableAutoDeleteObjects method inside Bucket public

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

This is a 🚀 Feature Request

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-s3Related to Amazon S3effort/mediumMedium work item – several days of effortfeature-requestA feature should be added or improved.p2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions