Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow overriding default removal policy #2973

Open
1 of 5 tasks
eladb opened this issue Jun 20, 2019 · 3 comments
Open
1 of 5 tasks

Allow overriding default removal policy #2973

eladb opened this issue Jun 20, 2019 · 3 comments
Labels
@aws-cdk/core Related to core CDK functionality effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p1

Comments

@eladb
Copy link
Contributor

eladb commented Jun 20, 2019

Note: for support questions, please first reference our documentation, then use Stackoverflow. This repository's issues are intended for feature requests and bug reports.

  • I'm submitting a ...

    • 🪲 bug report
    • 🚀 feature request
    • 📚 construct library gap
    • ☎️ security issue or vulnerability => Please see policy
    • ❓ support request => Please see note at the top of this template.
  • What is the current behavior?
    If the current behavior is a 🪲bug🪲: Please provide the steps to reproduce

The default removal policy for stateful resources is to retain the resource. This means that, for example, buckets will never be deleted.

  • What is the expected behavior (or behavior of feature suggested)?

It would be nice if it was possible to override this default behavior at the stack level and/or at the toolkit level. For example, I'd argue that development stacks would want the default to be "delete".

  • What is the motivation / use case for changing the behavior or adding this feature?

Reports from users that they don't understand why the CDK leaves all this garbage in their accounts.

@eladb eladb added the needs-triage This issue or PR still needs to be triaged. label Jun 20, 2019
@NGL321 NGL321 added @aws-cdk/core Related to core CDK functionality feature-request A feature should be added or improved. and removed needs-triage This issue or PR still needs to be triaged. labels Jun 20, 2019
@nmussy
Copy link
Contributor

nmussy commented Jul 12, 2019

This feature would be greatly appreciated.

One way I could see it is resources should be ephemeral during the stack development and retained once in production. Maybe it could be tied to the NODE_ENV variable, if that's not too much of a dark pattern. Likewise, a --development and --production CLI option.

Then again, just an explicit --discard and --retain option might be more clear.

There's also the issue of the Snapshot-able resources, listed at the end of this page. Should there also be a --retain-snapshot option, which snapshots the resources that support it, and keep the rest, and an equivalent --discard-snapshot?

@eladb
Copy link
Contributor Author

eladb commented Jan 23, 2020

Related to aws/aws-cdk-rfcs#23

@eladb eladb added the effort/medium Medium work item – several days of effort label Jan 23, 2020
@eladb eladb added the p1 label Aug 17, 2020
@eladb eladb assigned rix0rrr and unassigned eladb Aug 17, 2020
@Dzhuneyt
Copy link
Contributor

Dzhuneyt commented Jun 30, 2023

I was so frustrated by the leftover S3 buckets that are hard to delete, once they accumulate in large numbers inside the AWS account, I resorted to creating my own utility to purge orphan S3 buckets (ones not attached to any CloudFormation stacks):
https://github.com/Dzhuneyt/nuke-orphan-buckets

It would have been nice if CDK deleted those by default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/core Related to core CDK functionality effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p1
Projects
None yet
Development

No branches or pull requests

5 participants