-
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
refactor: clean up API for removal policy across the library #2893
Conversation
BREAKING CHANGE: multiple modules have been changed to use `cdk.RemovalPolicy` to configure the resource's removal policy. * **core:** `applyRemovalPolicy` is now `CfnResource.applyRemovalPolicy`. * **core:** `RemovalPolicy.Orphan` has been renamed to `Retain`. * **core:** `RemovalPolicy.Forbid` has been removed, use `Retain`. * **ecr:** `RepositoryProps.retain` is now `removalPolicy`, and defaults to `Retain` instead of remove since ECR is a stateful resource * **kms:** `KeyProps.retain` is now `removalPolicy` * **logs:** `LogGroupProps.retainLogGroup` is now `removalPolicy` * **logs:** `LogStreamProps.retainLogStream` is now `removalPolicy` * **rds:** `DatabaseClusterProps.deleteReplacePolicy` is now `removalPolicy` * **rds:** `DatabaseInstanceNewProps.deleteReplacePolicy` is now `removalPolicy`
Why? |
packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecr-source.expected.json
Show resolved
Hide resolved
packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecs-deploy.expected.json
Show resolved
Hide resolved
/** | ||
* Apply the same deletion policy to the resource's "UpdateReplacePolicy" | ||
*/ | ||
readonly applyToUpdateReplacePolicy?: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose it's good that you're doing a bit-for-bit replacement of functionality, but I actually think it's a bug if this is ever set to false
. We should always treat updates the same as deletes (because they will be physical deletes).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was just unsure whether applying this everywhere will break something and felt it's not the right thing to spend my time on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright then: #2901
I think it's a better practice to be explicit about deletion of stateful resources. |
You're being explicit about it in a place where no-one should ever or is ever going to look, and even if they were the semantics are well-defined and well-understood. I don't really see the point. But if it makes you happy, not a big deal. |
Thanks so much for taking the time to contribute to the AWS CDK ❤️ We will shortly assign someone to review this pull request and help get it
|
RemovalPolicy.Destory
is used, explicitly specifyDeletionPolicy: Delete
in CloudFormation (as oppose to relying on the fact the "Delete" is the default).BREAKING CHANGE: multiple modules have been changed to use
cdk.RemovalPolicy
to configure the resource's removal policy.
applyRemovalPolicy
is nowCfnResource.applyRemovalPolicy
.RemovalPolicy.Orphan
has been renamed toRetain
.RemovalPolicy.Forbid
has been removed, useRetain
.RepositoryProps.retain
is nowremovalPolicy
, and defaults toRetain
instead of remove since ECR is a stateful resourceKeyProps.retain
is nowremovalPolicy
LogGroupProps.retainLogGroup
is nowremovalPolicy
LogStreamProps.retainLogStream
is nowremovalPolicy
DatabaseClusterProps.deleteReplacePolicy
is nowremovalPolicy
DatabaseInstanceNewProps.deleteReplacePolicy
is nowremovalPolicy
Pull Request Checklist
design
folderBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license.