-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Discrepancy between CDK and CloudFormation in default DeletionPolicy of various resources #2601
Comments
I do not know of the reasoning behind the
The CDK behavior was introduced after complaints that the buckets wouldn't be deleted if they aren't empty (causing stack delete failures). So the default CDK behavior is to not attempt to delete S3 buckets. I agree this is an outlier in how this differs from the standard CFN behavior. With respects to this being a |
@RomainMuller I agree the line is rather thin on this particular issue. Personally, I generally lean towards setup/teardown approaches myself, and my personal preference on the default behavior would be to delete the items in the bucket, and then delete the bucket. Such a behavior is probably due to a limitation from CFN, however from a consistency standpoint I'd argue if the default behavior of almost anything else in the CDK is to have a I encountered this behavior a few days ago while testing out setup/teardown, and noticed a bunch of orphaned buckets, which led me to this issue because specifying For example, even when I specify:
The bucket is not destroyed, and upon stack deletion, the event log shows |
Not only S3, LogGroup is the same. It seems all resources are default to retain. Not only DeletionPolicy, but also UpdatePolicy. This is very bad as currently there is only very hacky way to specify DeletionPolicy. This really ought to be fixed. |
Also this naming thing is so inconsistent and desperate. DeletionPolicy vs. RemovalPolicy? Fine...but why the value for RemovalPolicy is "Destroy" other than "Remove"? |
Did you run I'm using this functionality quite often myself, and I've never had any issues with it working. |
Because "Remove" could suggest it's just removed from the template. "Destroy" makes it clear the resource is actually torn down. |
Then call it a destruction policy? The original name of "deletion policy" is definitely clearer than "removal policy", and would've solved this issue without making it confusing. |
Related to Stateful Resources |
Describe the bug
In CloudFormation, the default is to delete empty S3 buckets.
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html
In CDK, the default is to retain s3 buckets:
https://github.com/awslabs/aws-cdk/blob/7cb8e5e61debd5b1f06293051bbb522f0331fb3c/packages/%40aws-cdk/aws-s3/lib/bucket.ts#L759
I see 2 confusing things here:
I think it is a bug, but you might argue it is a feature.
I'd like to understand the logic to be the least surprised when using the CDK.
Thanks!
The text was updated successfully, but these errors were encountered: