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

App: Support setting defaultRemovalPolicy #718

Merged
merged 3 commits into from
Aug 20, 2021
Merged

App: Support setting defaultRemovalPolicy #718

merged 3 commits into from
Aug 20, 2021

Conversation

thdxr
Copy link
Contributor

@thdxr thdxr commented Aug 18, 2021

Closes #634

@thdxr thdxr added the enhancement New feature or request label Aug 18, 2021
@thdxr thdxr requested a review from fwang August 18, 2021 19:35
@thdxr thdxr merged commit b782591 into master Aug 20, 2021
@thdxr thdxr deleted the 634-removal-policy branch August 20, 2021 12:22
@fwang
Copy link
Contributor

fwang commented Aug 21, 2021

I think S3 buckets might be trouble b/c they need to be emptied before removed. You'd have to set autoDeleteObjects:

new s3.Bucket(this, 'MyBucket', {
  removalPolicy: RemovalPolicy.DESTROY,
  autoDeleteObjects: true,
});

And when autoDeleteObjects is true, CDK creates a custom resource to empty the bucket on stack remove.

I can't think of a good solution off the bat. We might not be able to set this flag right before synth. Not sure, maybe give it a try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Set all resources' removalPolicy in the entire App/Stack to DESTROY
2 participants