Skip to content

(app-staging-synthesizer): clean up staging resources on deletion #25722

@kaizencc

Description

@kaizencc

Describe the feature

When using the AppStagingSynthesizer, staging resources that live alongside your cdk app do not get deleted when the app gets deleted. This is because these resources are not empty, and CloudFormation cannot delete un-empty S3 buckets and ECR repos.

We solve this problem in the CDK with custom resources, but these custom resources are assets themselves that need to live in a staging bucket. This creates a chicken-and-egg problem for the AppStagingSynthesizer, because there's nowhere to put the cleanup custom resource asset.

Use Case

Users using cdk deploy and cdk destroy on the AppStagingSynthesizer as part of development. We don't destroy the staging resources, so the user has to manage their deletion themselves. Otherwise, if you cdk deploy a resource with the same name, cdk deploy will fail.

Proposed Solution

Potentially, we can minimize these custom resources and provide them as inline code directly in the template. If we can do that, we can clean up staging resources on deletion and remove a big friction point for users.

Other Information

No response

Acknowledgements

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

CDK version used

CDK v1.83.0

Environment details (OS name and version, etc.)

mac

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/app-staging-synthesizer-alphaRelated to the @aws-cdk/app-staging-synthesizer-alpha packageeffort/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