Skip to content

Commit 65014ab

Browse files
author
Elad Ben-Israel
authored
refactor: clean up API for removal policy across the library (#2893)
- Normalize how deletion policy is configured for stateful resources across the AWS Construct Library. - Simplify the model by removing the future-proofing of "RemovalPolicy.Forbid". - When `RemovalPolicy.Destory` is used, explicitly specify `DeletionPolicy: 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. * **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`
1 parent f4c8dcd commit 65014ab

File tree

53 files changed

+196
-110
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+196
-110
lines changed

packages/@aws-cdk/app-delivery/test/integ.cicd.expected.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"Resources": {
33
"ArtifactBucket7410C9EF": {
4+
"DeletionPolicy": "Delete",
45
"Type": "AWS::S3::Bucket"
56
},
67
"CodePipelineRoleB3A660B4": {
@@ -281,4 +282,4 @@
281282
}
282283
}
283284
}
284-
}
285+
}

packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-bucket-logging.expected.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"Resources": {
33
"Bucket83908E77": {
4+
"DeletionPolicy": "Delete",
45
"Type": "AWS::S3::Bucket"
56
},
67
"AnAmazingWebsiteProbablyCFDistribution47E3983B": {

packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-ipv6-disabled.expected.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"Resources": {
33
"Bucket83908E77": {
4+
"DeletionPolicy": "Delete",
45
"Type": "AWS::S3::Bucket"
56
},
67
"MyDistributionCFDistributionDE147309": {

packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-lambda-association.expected.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"Resources": {
33
"Bucket83908E77": {
4+
"DeletionPolicy": "Delete",
45
"Type": "AWS::S3::Bucket"
56
},
67
"LambdaServiceRoleA8ED4D3B": {

packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-s3.expected.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"Resources": {
33
"Bucket83908E77": {
4+
"DeletionPolicy": "Delete",
45
"Type": "AWS::S3::Bucket"
56
},
67
"BucketPolicyE9A3008A": {

packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront.expected.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"Resources": {
33
"Bucket83908E77": {
4+
"DeletionPolicy": "Delete",
45
"Type": "AWS::S3::Bucket"
56
},
67
"MyDistributionCFDistributionDE147309": {

packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail.lit.expected.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"Resources": {
33
"Bucket83908E77": {
4-
"Type": "AWS::S3::Bucket"
4+
"Type": "AWS::S3::Bucket",
5+
"DeletionPolicy": "Delete"
56
},
67
"TrailS30071F172": {
78
"Type": "AWS::S3::Bucket",
@@ -124,4 +125,4 @@
124125
]
125126
}
126127
}
127-
}
128+
}

packages/@aws-cdk/aws-codebuild/test/integ.caching.expected.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"Resources": {
33
"CacheBucket41D9D0B0": {
4+
"DeletionPolicy": "Delete",
45
"Type": "AWS::S3::Bucket"
56
},
67
"MyProjectRole9BBE5233": {

packages/@aws-cdk/aws-codebuild/test/integ.ecr.lit.expected.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"Resources": {
33
"MyRepoF4F48043": {
4+
"DeletionPolicy": "Retain",
45
"Type": "AWS::ECR::Repository",
56
"Properties": {
67
"RepositoryPolicyText": {

packages/@aws-cdk/aws-codebuild/test/integ.project-bucket.expected.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"Resources": {
33
"MyBucketF68F3FF0": {
4+
"DeletionPolicy": "Delete",
45
"Type": "AWS::S3::Bucket"
56
},
67
"MyProjectRole9BBE5233": {

0 commit comments

Comments
 (0)