From 72712e47588a123ba4e142a38436c7ca3c214481 Mon Sep 17 00:00:00 2001 From: Rico Huijbers Date: Fri, 5 Jul 2019 16:22:10 +0200 Subject: [PATCH 1/2] fix(core): UpdateReplacePolicy mirrors DeletionPolicy When setting the DeletionPolicy, the UpdateReplacePolicy should also be set. There's the same implication of data loss for one and the other. Fixes #2901. --- .../test/integ.cicd.expected.json | 3 +- .../@aws-cdk/aws-apigateway/lib/deployment.ts | 4 +-- .../test/integ.restapi.expected.json | 3 +- .../aws-apigateway/test/test.deployment.ts | 3 +- ...nteg.trivial-lambda-resource.expected.json | 5 ++-- .../aws-cloudformation/test/test.resource.ts | 3 ++ ...eg.cloudfront-bucket-logging.expected.json | 6 ++-- ...teg.cloudfront-ipv6-disabled.expected.json | 3 +- ...loudfront-lambda-association.expected.json | 1 + .../test/integ.cloudfront-s3.expected.json | 1 + .../test/integ.cloudfront.expected.json | 1 + .../aws-cloudfront/test/test.basic.ts | 3 ++ .../test/integ.cloudtrail.lit.expected.json | 6 ++-- .../test/integ.caching.expected.json | 3 +- .../test/integ.docker-asset.lit.expected.json | 5 ++-- .../test/integ.ecr.lit.expected.json | 3 +- .../test/integ.project-bucket.expected.json | 3 +- ...-secondary-sources-artifacts.expected.json | 3 +- .../aws-codebuild/test/test.codebuild.ts | 3 +- ...g.cfn-template-from-repo.lit.expected.json | 6 ++-- ...yed-through-codepipeline.lit.expected.json | 6 ++-- .../test/integ.lambda-pipeline.expected.json | 12 +++++--- .../integ.pipeline-alexa-deploy.expected.json | 9 ++++-- ...eg.pipeline-cfn-cross-region.expected.json | 3 +- ...ipeline-cfn-with-action-role.expected.json | 3 +- .../test/integ.pipeline-cfn.expected.json | 11 ++++--- ...uild-multiple-inputs-outputs.expected.json | 3 +- ...g.pipeline-code-commit-build.expected.json | 6 ++-- .../integ.pipeline-code-commit.expected.json | 6 ++-- .../integ.pipeline-code-deploy.expected.json | 3 +- .../integ.pipeline-ecr-source.expected.json | 6 ++-- .../integ.pipeline-ecs-deploy.expected.json | 6 ++-- .../test/integ.pipeline-events.expected.json | 6 ++-- .../test/integ.pipeline-jenkins.expected.json | 3 +- ...teg.pipeline-manual-approval.expected.json | 3 +- .../integ.pipeline-s3-deploy.expected.json | 14 +++++---- .../test/integ.dynamodb.global.expected.json | 14 +++++---- .../test/integ.autoscaling.lit.expected.json | 5 ++-- .../test/integ.dynamodb.expected.json | 14 +++++---- .../integ.dynamodb.ondemand.expected.json | 14 +++++---- .../test/integ.assets-docker.expected.json | 5 ++-- .../aws-ecr/test/integ.basic.expected.json | 1 + .../@aws-cdk/aws-ecr/test/test.repository.ts | 3 +- ...integ.scheduled-ecs-task.lit.expected.json | 5 ++-- .../fargate/integ.asset-image.expected.json | 6 ++-- .../fargate/integ.executionrole.expected.json | 3 +- .../test/fargate/integ.l3.expected.json | 3 +- ...g.scheduled-fargate-task.lit.expected.json | 9 ++++-- .../integ.pipeline-event-target.expected.json | 8 +++-- .../integ.event-ec2-task.lit.expected.json | 6 ++-- .../integ.event-fargate-task.expected.json | 9 ++++-- .../aws-glue/test/integ.table.expected.json | 12 +++++--- .../@aws-cdk/aws-glue/test/test.database.ts | 3 +- packages/@aws-cdk/aws-glue/test/test.table.ts | 3 +- .../@aws-cdk/aws-kinesis/test/test.stream.ts | 15 ++++++---- .../test/integ.key-sharing.lit.expected.json | 5 ++-- .../aws-kms/test/integ.key.expected.json | 5 ++-- packages/@aws-cdk/aws-kms/test/test.key.ts | 14 +++++---- .../test/integ.dynamodb.expected.json | 5 ++-- .../test/integ.s3.expected.json | 1 + .../test/integ.metricfilter.lit.expected.json | 1 + .../@aws-cdk/aws-logs/test/test.loggroup.ts | 6 ++-- .../aws-rds/test/integ.cluster.expected.json | 5 ++-- ...nteg.cloudfront-alias-target.expected.json | 1 + .../integ.bucket-deployment.expected.json | 14 +++++---- .../test/integ.notifications.expected.json | 4 ++- .../integ.bucket-notifications.expected.json | 4 ++- .../test/notifications.test.ts | 3 +- .../aws-s3-notifications/test/sns.test.ts | 4 ++- ...teg.sns-bucket-notifications.expected.json | 3 +- .../integ.bucket-notifications.expected.json | 5 +++- .../integ.bucket-sharing.lit.expected.json | 1 + .../integ.bucket.domain-name.expected.json | 3 +- .../aws-s3/test/integ.bucket.expected.json | 5 +++- .../test/integ.bucket.url.lit.expected.json | 5 ++-- .../aws-s3/test/integ.lifecycle.expected.json | 3 +- packages/@aws-cdk/aws-s3/test/test.bucket.ts | 29 +++++++++++++++---- .../aws-ses/test/integ.receipt.expected.json | 6 ++-- .../test/integ.ec2-task.expected.json | 6 ++-- .../test/integ.fargate-task.expected.json | 6 ++-- .../test/integ.sagemaker.expected.json | 8 +++-- packages/@aws-cdk/core/lib/cfn-resource.ts | 2 +- packages/@aws-cdk/core/lib/removal-policy.ts | 2 +- packages/@aws-cdk/core/test/test.resource.ts | 8 ++--- .../integ.aws-custom-resource.expected.json | 11 ++++--- .../resources/com/myorg/expected.cfn.json | 17 +++++++---- packages/cdk-dasm/test/bucket-key.json | 4 ++- .../test/__snapshots__/synth.test.js.snap | 5 ++++ 88 files changed, 341 insertions(+), 166 deletions(-) diff --git a/packages/@aws-cdk/app-delivery/test/integ.cicd.expected.json b/packages/@aws-cdk/app-delivery/test/integ.cicd.expected.json index 5cf8e0a60e2eb..c95b3dce7018e 100644 --- a/packages/@aws-cdk/app-delivery/test/integ.cicd.expected.json +++ b/packages/@aws-cdk/app-delivery/test/integ.cicd.expected.json @@ -2,7 +2,8 @@ "Resources": { "ArtifactBucket7410C9EF": { "Type": "AWS::S3::Bucket", - "DeletionPolicy": "Delete" + "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete" }, "CodePipelineRoleB3A660B4": { "Type": "AWS::IAM::Role", diff --git a/packages/@aws-cdk/aws-apigateway/lib/deployment.ts b/packages/@aws-cdk/aws-apigateway/lib/deployment.ts index 3aecccee8c090..6de9f7d71cfec 100644 --- a/packages/@aws-cdk/aws-apigateway/lib/deployment.ts +++ b/packages/@aws-cdk/aws-apigateway/lib/deployment.ts @@ -1,4 +1,4 @@ -import { CfnDeletionPolicy, Construct, Lazy, Resource, Stack } from '@aws-cdk/core'; +import { Construct, Lazy, RemovalPolicy, Resource, Stack } from '@aws-cdk/core'; import crypto = require('crypto'); import { CfnDeployment, CfnDeploymentProps } from './apigateway.generated'; import { IRestApi } from './restapi'; @@ -72,7 +72,7 @@ export class Deployment extends Resource { }); if (props.retainDeployments) { - this.resource.cfnOptions.deletionPolicy = CfnDeletionPolicy.RETAIN; + this.resource.applyRemovalPolicy(RemovalPolicy.RETAIN); } this.api = props.api; diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.expected.json b/packages/@aws-cdk/aws-apigateway/test/integ.restapi.expected.json index 0519a38ee286b..2bedee48d3649 100644 --- a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.expected.json +++ b/packages/@aws-cdk/aws-apigateway/test/integ.restapi.expected.json @@ -26,7 +26,8 @@ "myapiv1toysPUT59AFBBC2", "myapiv1toysA55FCBC4" ], - "DeletionPolicy": "Retain" + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" }, "myapiDeploymentStagebeta96434BEB": { "Type": "AWS::ApiGateway::Stage", diff --git a/packages/@aws-cdk/aws-apigateway/test/test.deployment.ts b/packages/@aws-cdk/aws-apigateway/test/test.deployment.ts index ddf2a8525137a..006a88e2be8fa 100644 --- a/packages/@aws-cdk/aws-apigateway/test/test.deployment.ts +++ b/packages/@aws-cdk/aws-apigateway/test/test.deployment.ts @@ -99,7 +99,8 @@ export = { Ref: "apiC8550315" } }, - DeletionPolicy: "Retain" + DeletionPolicy: "Retain", + UpdateReplacePolicy: "Retain" } } }); diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.trivial-lambda-resource.expected.json b/packages/@aws-cdk/aws-cloudformation/test/integ.trivial-lambda-resource.expected.json index 3260c36cf93e6..6a6a668af1a0d 100644 --- a/packages/@aws-cdk/aws-cloudformation/test/integ.trivial-lambda-resource.expected.json +++ b/packages/@aws-cdk/aws-cloudformation/test/integ.trivial-lambda-resource.expected.json @@ -11,7 +11,8 @@ }, "Message": "CustomResource says hello" }, - "DeletionPolicy": "Delete" + "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete" }, "SingletonLambdaf7d4f7304ee111e89c2dfa7ae01bbebcServiceRoleFE9ABB04": { "Type": "AWS::IAM::Role", @@ -86,4 +87,4 @@ } } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/aws-cloudformation/test/test.resource.ts b/packages/@aws-cdk/aws-cloudformation/test/test.resource.ts index f6dcdffc09f11..015119e1b8416 100644 --- a/packages/@aws-cdk/aws-cloudformation/test/test.resource.ts +++ b/packages/@aws-cdk/aws-cloudformation/test/test.resource.ts @@ -50,6 +50,7 @@ export = testCase({ // THEN expect(stack).to(haveResource('AWS::CloudFormation::CustomResource', { DeletionPolicy: 'Retain', + UpdateReplacePolicy: 'Retain', }, ResourcePart.CompleteDefinition)); test.done(); @@ -112,6 +113,7 @@ export = testCase({ "Custom1D319B237": { "Type": "AWS::CloudFormation::CustomResource", "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete", "Properties": { "ServiceToken": { "Fn::GetAtt": [ @@ -124,6 +126,7 @@ export = testCase({ "Custom2DD5FB44D": { "Type": "AWS::CloudFormation::CustomResource", "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete", "Properties": { "ServiceToken": { "Fn::GetAtt": [ diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-bucket-logging.expected.json b/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-bucket-logging.expected.json index 0ecdcc63eb1ab..1efdce745956c 100644 --- a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-bucket-logging.expected.json +++ b/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-bucket-logging.expected.json @@ -2,6 +2,7 @@ "Resources": { "Bucket83908E77": { "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete", "Type": "AWS::S3::Bucket" }, "AnAmazingWebsiteProbablyCFDistribution47E3983B": { @@ -72,7 +73,8 @@ }, "AnAmazingWebsiteProbably2LoggingBucket222F7CE9": { "Type": "AWS::S3::Bucket", - "DeletionPolicy": "Retain" + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" }, "AnAmazingWebsiteProbably2CFDistribution7C1CCD12": { "Type": "AWS::CloudFront::Distribution", @@ -140,4 +142,4 @@ } } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-ipv6-disabled.expected.json b/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-ipv6-disabled.expected.json index 0a2324cd51747..54995c0239139 100644 --- a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-ipv6-disabled.expected.json +++ b/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-ipv6-disabled.expected.json @@ -2,6 +2,7 @@ "Resources": { "Bucket83908E77": { "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete", "Type": "AWS::S3::Bucket" }, "MyDistributionCFDistributionDE147309": { @@ -51,4 +52,4 @@ } } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-lambda-association.expected.json b/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-lambda-association.expected.json index 9a5787c650747..99705320a9eeb 100644 --- a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-lambda-association.expected.json +++ b/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-lambda-association.expected.json @@ -2,6 +2,7 @@ "Resources": { "Bucket83908E77": { "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete", "Type": "AWS::S3::Bucket" }, "LambdaServiceRoleA8ED4D3B": { diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-s3.expected.json b/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-s3.expected.json index 1893492fbfeca..b78dea46c32c3 100644 --- a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-s3.expected.json +++ b/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-s3.expected.json @@ -2,6 +2,7 @@ "Resources": { "Bucket83908E77": { "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete", "Type": "AWS::S3::Bucket" }, "BucketPolicyE9A3008A": { diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront.expected.json b/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront.expected.json index 24de06e3d5e25..7a9c50c8f4854 100644 --- a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront.expected.json +++ b/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront.expected.json @@ -2,6 +2,7 @@ "Resources": { "Bucket83908E77": { "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete", "Type": "AWS::S3::Bucket" }, "MyDistributionCFDistributionDE147309": { diff --git a/packages/@aws-cdk/aws-cloudfront/test/test.basic.ts b/packages/@aws-cdk/aws-cloudfront/test/test.basic.ts index 1f638903b8d07..941ab9f886083 100644 --- a/packages/@aws-cdk/aws-cloudfront/test/test.basic.ts +++ b/packages/@aws-cdk/aws-cloudfront/test/test.basic.ts @@ -119,6 +119,7 @@ export = { "Bucket83908E77": { "Type": "AWS::S3::Bucket", "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain", }, "AnAmazingWebsiteProbablyCFDistribution47E3983B": { "Type": "AWS::CloudFront::Distribution", @@ -194,6 +195,7 @@ export = { "Bucket83908E77": { "Type": "AWS::S3::Bucket", "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain", }, "AnAmazingWebsiteProbablyCFDistribution47E3983B": { "Type": "AWS::CloudFront::Distribution", @@ -272,6 +274,7 @@ export = { "Bucket83908E77": { "Type": "AWS::S3::Bucket", "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain", }, "AnAmazingWebsiteProbablyCFDistribution47E3983B": { "Type": "AWS::CloudFront::Distribution", diff --git a/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail.lit.expected.json b/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail.lit.expected.json index cfde3aca8cf7f..627db27e26b93 100644 --- a/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail.lit.expected.json +++ b/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail.lit.expected.json @@ -2,11 +2,13 @@ "Resources": { "Bucket83908E77": { "Type": "AWS::S3::Bucket", - "DeletionPolicy": "Delete" + "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete" }, "TrailS30071F172": { "Type": "AWS::S3::Bucket", - "DeletionPolicy": "Retain" + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" }, "TrailS3PolicyE42170FE": { "Type": "AWS::S3::BucketPolicy", diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.caching.expected.json b/packages/@aws-cdk/aws-codebuild/test/integ.caching.expected.json index 95ab4cb3c2a5d..3f37e6f1fc03e 100644 --- a/packages/@aws-cdk/aws-codebuild/test/integ.caching.expected.json +++ b/packages/@aws-cdk/aws-codebuild/test/integ.caching.expected.json @@ -2,6 +2,7 @@ "Resources": { "CacheBucket41D9D0B0": { "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete", "Type": "AWS::S3::Bucket" }, "MyProjectRole9BBE5233": { @@ -178,4 +179,4 @@ } } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.docker-asset.lit.expected.json b/packages/@aws-cdk/aws-codebuild/test/integ.docker-asset.lit.expected.json index d4b6b0e10e84b..5cf8b346e912c 100644 --- a/packages/@aws-cdk/aws-codebuild/test/integ.docker-asset.lit.expected.json +++ b/packages/@aws-cdk/aws-codebuild/test/integ.docker-asset.lit.expected.json @@ -72,7 +72,8 @@ "AdoptEcrRepositorydbc60defc59544bcaa5c28c95d68f62cServiceRoleDefaultPolicy6BC8737C", "AdoptEcrRepositorydbc60defc59544bcaa5c28c95d68f62cServiceRoleD788AA17" ], - "DeletionPolicy": "Delete" + "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete" }, "AdoptEcrRepositorydbc60defc59544bcaa5c28c95d68f62cServiceRoleD788AA17": { "Type": "AWS::IAM::Role", @@ -455,4 +456,4 @@ } } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.ecr.lit.expected.json b/packages/@aws-cdk/aws-codebuild/test/integ.ecr.lit.expected.json index 5bac318649a12..bd57047461514 100644 --- a/packages/@aws-cdk/aws-codebuild/test/integ.ecr.lit.expected.json +++ b/packages/@aws-cdk/aws-codebuild/test/integ.ecr.lit.expected.json @@ -2,6 +2,7 @@ "Resources": { "MyRepoF4F48043": { "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain", "Type": "AWS::ECR::Repository", "Properties": { "RepositoryPolicyText": { @@ -202,4 +203,4 @@ } } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-bucket.expected.json b/packages/@aws-cdk/aws-codebuild/test/integ.project-bucket.expected.json index 515a318115853..e8edfde6b5ac9 100644 --- a/packages/@aws-cdk/aws-codebuild/test/integ.project-bucket.expected.json +++ b/packages/@aws-cdk/aws-codebuild/test/integ.project-bucket.expected.json @@ -2,6 +2,7 @@ "Resources": { "MyBucketF68F3FF0": { "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete", "Type": "AWS::S3::Bucket" }, "MyProjectRole9BBE5233": { @@ -169,4 +170,4 @@ } } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-secondary-sources-artifacts.expected.json b/packages/@aws-cdk/aws-codebuild/test/integ.project-secondary-sources-artifacts.expected.json index 0f8366ee1ce80..eff0a5deb9346 100644 --- a/packages/@aws-cdk/aws-codebuild/test/integ.project-secondary-sources-artifacts.expected.json +++ b/packages/@aws-cdk/aws-codebuild/test/integ.project-secondary-sources-artifacts.expected.json @@ -2,6 +2,7 @@ "Resources": { "MyBucketF68F3FF0": { "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete", "Type": "AWS::S3::Bucket" }, "MyProjectRole9BBE5233": { @@ -222,4 +223,4 @@ } } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/aws-codebuild/test/test.codebuild.ts b/packages/@aws-cdk/aws-codebuild/test/test.codebuild.ts index 1210e88e70754..64f045b30e521 100644 --- a/packages/@aws-cdk/aws-codebuild/test/test.codebuild.ts +++ b/packages/@aws-cdk/aws-codebuild/test/test.codebuild.ts @@ -312,7 +312,8 @@ export = { "Resources": { "MyBucketF68F3FF0": { "Type": "AWS::S3::Bucket", - "DeletionPolicy": "Retain" + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" }, "MyProjectRole9BBE5233": { "Type": "AWS::IAM::Role", diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.cfn-template-from-repo.lit.expected.json b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.cfn-template-from-repo.lit.expected.json index 1128d4fcf2b50..185b5db782d92 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.cfn-template-from-repo.lit.expected.json +++ b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.cfn-template-from-repo.lit.expected.json @@ -106,7 +106,8 @@ "Version": "2012-10-17" } }, - "DeletionPolicy": "Retain" + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" }, "PipelineArtifactsBucket22248F97": { "Type": "AWS::S3::Bucket", @@ -127,7 +128,8 @@ ] } }, - "DeletionPolicy": "Retain" + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" }, "PipelineRoleD68726F7": { "Type": "AWS::IAM::Role", diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.lambda-deployed-through-codepipeline.lit.expected.json b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.lambda-deployed-through-codepipeline.lit.expected.json index d94d8873b169a..d01e15942a905 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.lambda-deployed-through-codepipeline.lit.expected.json +++ b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.lambda-deployed-through-codepipeline.lit.expected.json @@ -156,7 +156,8 @@ "Version": "2012-10-17" } }, - "DeletionPolicy": "Retain" + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" }, "PipelineArtifactsBucket22248F97": { "Type": "AWS::S3::Bucket", @@ -177,7 +178,8 @@ ] } }, - "DeletionPolicy": "Retain" + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" }, "PipelineRoleD68726F7": { "Type": "AWS::IAM::Role", diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.lambda-pipeline.expected.json b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.lambda-pipeline.expected.json index d0169c49a5d88..6cd4f36543bbc 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.lambda-pipeline.expected.json +++ b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.lambda-pipeline.expected.json @@ -81,7 +81,8 @@ "Version": "2012-10-17" } }, - "DeletionPolicy": "Retain" + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" }, "PipelineArtifactsBucket22248F97": { "Type": "AWS::S3::Bucket", @@ -102,7 +103,8 @@ ] } }, - "DeletionPolicy": "Retain" + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" }, "PipelineRoleD68726F7": { "Type": "AWS::IAM::Role", @@ -573,7 +575,8 @@ "Status": "Enabled" } }, - "DeletionPolicy": "Delete" + "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete" }, "PipelineBucketawscdkcodepipelinelambdaPipeline87A4B3D3SourceEventRuleCE4D4505": { "Type": "AWS::Events::Rule", @@ -648,7 +651,8 @@ }, "CloudTrailS310CD22F2": { "Type": "AWS::S3::Bucket", - "DeletionPolicy": "Retain" + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" }, "CloudTrailS3PolicyEA49A03E": { "Type": "AWS::S3::BucketPolicy", diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-alexa-deploy.expected.json b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-alexa-deploy.expected.json index 7a6003eaa502b..a80249669c76b 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-alexa-deploy.expected.json +++ b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-alexa-deploy.expected.json @@ -7,7 +7,8 @@ "Status": "Enabled" } }, - "DeletionPolicy": "Delete" + "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete" }, "PipelineArtifactsBucketEncryptionKey01D58D69": { "Type": "AWS::KMS::Key", @@ -90,7 +91,8 @@ "Version": "2012-10-17" } }, - "DeletionPolicy": "Retain" + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" }, "PipelineArtifactsBucket22248F97": { "Type": "AWS::S3::Bucket", @@ -111,7 +113,8 @@ ] } }, - "DeletionPolicy": "Retain" + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" }, "PipelineRoleD68726F7": { "Type": "AWS::IAM::Role", diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-cfn-cross-region.expected.json b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-cfn-cross-region.expected.json index 2d539da7db911..1156ffa809e83 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-cfn-cross-region.expected.json +++ b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-cfn-cross-region.expected.json @@ -7,7 +7,8 @@ "Status": "Enabled" } }, - "DeletionPolicy": "Delete" + "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete" }, "MyPipelineRoleC0D47CA4": { "Type": "AWS::IAM::Role", diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-cfn-with-action-role.expected.json b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-cfn-with-action-role.expected.json index fe61459a8cab7..58e08cb069fda 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-cfn-with-action-role.expected.json +++ b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-cfn-with-action-role.expected.json @@ -7,7 +7,8 @@ "Status": "Enabled" } }, - "DeletionPolicy": "Delete" + "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete" }, "ActionRole60B0EDF7": { "Type": "AWS::IAM::Role", diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-cfn.expected.json b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-cfn.expected.json index acc964ed1da64..8605d3cf64511 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-cfn.expected.json +++ b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-cfn.expected.json @@ -114,7 +114,8 @@ "Version": "2012-10-17" } }, - "DeletionPolicy": "Retain" + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" }, "PipelineArtifactsBucket22248F97": { "Type": "AWS::S3::Bucket", @@ -135,7 +136,8 @@ ] } }, - "DeletionPolicy": "Retain" + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" }, "PipelineRoleD68726F7": { "Type": "AWS::IAM::Role", @@ -781,7 +783,8 @@ "Status": "Enabled" } }, - "DeletionPolicy": "Delete" + "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete" }, "CfnChangeSetRole6F05F6FC": { "Type": "AWS::IAM::Role", @@ -811,4 +814,4 @@ } } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-build-multiple-inputs-outputs.expected.json b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-build-multiple-inputs-outputs.expected.json index 3ce027cd3cced..4a43090a80dcf 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-build-multiple-inputs-outputs.expected.json +++ b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-build-multiple-inputs-outputs.expected.json @@ -79,7 +79,8 @@ "Status": "Enabled" } }, - "DeletionPolicy": "Delete" + "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete" }, "PipelineRoleD68726F7": { "Type": "AWS::IAM::Role", diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-commit-build.expected.json b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-commit-build.expected.json index 9f7dd0e13cdc7..1fded0fbf168b 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-commit-build.expected.json +++ b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-commit-build.expected.json @@ -340,7 +340,8 @@ "Version": "2012-10-17" } }, - "DeletionPolicy": "Retain" + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" }, "PipelineArtifactsBucket22248F97": { "Type": "AWS::S3::Bucket", @@ -361,7 +362,8 @@ ] } }, - "DeletionPolicy": "Retain" + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" }, "PipelineRoleD68726F7": { "Type": "AWS::IAM::Role", diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-commit.expected.json b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-commit.expected.json index 360da5b54c718..14b198e0852bc 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-commit.expected.json +++ b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-commit.expected.json @@ -155,7 +155,8 @@ "Version": "2012-10-17" } }, - "DeletionPolicy": "Retain" + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" }, "PipelineArtifactsBucket22248F97": { "Type": "AWS::S3::Bucket", @@ -176,7 +177,8 @@ ] } }, - "DeletionPolicy": "Retain" + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" }, "PipelineRoleD68726F7": { "Type": "AWS::IAM::Role", diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-deploy.expected.json b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-deploy.expected.json index ad0d2cc5f8f52..808221cf4f492 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-deploy.expected.json +++ b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-deploy.expected.json @@ -92,7 +92,8 @@ "Status": "Enabled" } }, - "DeletionPolicy": "Delete" + "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete" }, "PipelineRoleD68726F7": { "Type": "AWS::IAM::Role", diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecr-source.expected.json b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecr-source.expected.json index 68f342ae88c02..e2d3b8f331656 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecr-source.expected.json +++ b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecr-source.expected.json @@ -2,7 +2,8 @@ "Resources": { "MyBucketF68F3FF0": { "Type": "AWS::S3::Bucket", - "DeletionPolicy": "Delete" + "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete" }, "MyPipelineRoleC0D47CA4": { "Type": "AWS::IAM::Role", @@ -370,7 +371,8 @@ }, "MyEcrRepo767466D0": { "Type": "AWS::ECR::Repository", - "DeletionPolicy": "Retain" + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" }, "MyEcrRepoawscdkcodepipelineecrsourceMyPipeline63CF3194SourceEventRule911FDB6D": { "Type": "AWS::Events::Rule", diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecs-deploy.expected.json b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecs-deploy.expected.json index 43f06d00801bd..d07defcdb2122 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecs-deploy.expected.json +++ b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecs-deploy.expected.json @@ -195,7 +195,8 @@ }, "EcrRepoBB83A592": { "Type": "AWS::ECR::Repository", - "DeletionPolicy": "Retain" + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" }, "TaskDefTaskRole1EDB4A67": { "Type": "AWS::IAM::Role", @@ -316,7 +317,8 @@ "Status": "Enabled" } }, - "DeletionPolicy": "Delete" + "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete" }, "EcsProjectRoleE2F0E9D2": { "Type": "AWS::IAM::Role", diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-events.expected.json b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-events.expected.json index ca5873f6a6ed6..88c208b25355c 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-events.expected.json +++ b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-events.expected.json @@ -102,7 +102,8 @@ "Version": "2012-10-17" } }, - "DeletionPolicy": "Retain" + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" }, "MyPipelineArtifactsBucket727923DD": { "Type": "AWS::S3::Bucket", @@ -123,7 +124,8 @@ ] } }, - "DeletionPolicy": "Retain" + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" }, "MyPipelineRoleC0D47CA4": { "Type": "AWS::IAM::Role", diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-jenkins.expected.json b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-jenkins.expected.json index f0c9dcab53b19..e8e01bf50fa20 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-jenkins.expected.json +++ b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-jenkins.expected.json @@ -7,7 +7,8 @@ "Status": "Enabled" } }, - "DeletionPolicy": "Retain" + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" }, "PipelineRoleD68726F7": { "Type": "AWS::IAM::Role", diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-manual-approval.expected.json b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-manual-approval.expected.json index a4033c8ba6512..43a4d844e95a7 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-manual-approval.expected.json +++ b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-manual-approval.expected.json @@ -2,7 +2,8 @@ "Resources": { "Bucket83908E77": { "Type": "AWS::S3::Bucket", - "DeletionPolicy": "Retain" + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" }, "PipelineRoleD68726F7": { "Type": "AWS::IAM::Role", diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-s3-deploy.expected.json b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-s3-deploy.expected.json index 1ef960cdf766c..a924ce67920ea 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-s3-deploy.expected.json +++ b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-s3-deploy.expected.json @@ -7,11 +7,13 @@ "Status": "Enabled" } }, - "DeletionPolicy": "Delete" + "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete" }, "DeployBucket67E2C076": { "Type": "AWS::S3::Bucket", - "DeletionPolicy": "Retain" + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" }, "PipelineArtifactsBucketEncryptionKey01D58D69": { "Type": "AWS::KMS::Key", @@ -110,7 +112,8 @@ "Version": "2012-10-17" } }, - "DeletionPolicy": "Retain" + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" }, "PipelineArtifactsBucket22248F97": { "Type": "AWS::S3::Bucket", @@ -131,7 +134,8 @@ ] } }, - "DeletionPolicy": "Retain" + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" }, "PipelineRoleD68726F7": { "Type": "AWS::IAM::Role", @@ -587,4 +591,4 @@ } } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/aws-dynamodb-global/test/integ.dynamodb.global.expected.json b/packages/@aws-cdk/aws-dynamodb-global/test/integ.dynamodb.global.expected.json index 8f895c2d9dec7..9e5abb9fc9bf1 100644 --- a/packages/@aws-cdk/aws-dynamodb-global/test/integ.dynamodb.global.expected.json +++ b/packages/@aws-cdk/aws-dynamodb-global/test/integ.dynamodb.global.expected.json @@ -25,7 +25,8 @@ }, "TableName": "integrationtest" }, - "DeletionPolicy": "Delete" + "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete" } } }, @@ -55,7 +56,8 @@ }, "TableName": "integrationtest" }, - "DeletionPolicy": "Delete" + "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete" } } }, @@ -85,7 +87,8 @@ }, "TableName": "integrationtest" }, - "DeletionPolicy": "Delete" + "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete" } } }, @@ -236,7 +239,8 @@ "ResourceType": "Custom::DynamoGlobalTableCoordinator", "TableName": "integrationtest" }, - "DeletionPolicy": "Delete" + "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete" } }, "Parameters": { @@ -254,4 +258,4 @@ } } } -] \ No newline at end of file +] diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.autoscaling.lit.expected.json b/packages/@aws-cdk/aws-dynamodb/test/integ.autoscaling.lit.expected.json index bb20518e3d8d4..9a735c373fcdc 100644 --- a/packages/@aws-cdk/aws-dynamodb/test/integ.autoscaling.lit.expected.json +++ b/packages/@aws-cdk/aws-dynamodb/test/integ.autoscaling.lit.expected.json @@ -20,7 +20,8 @@ "WriteCapacityUnits": 5 } }, - "DeletionPolicy": "Delete" + "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete" }, "TableReadScalingTargetF96E9F76": { "Type": "AWS::ApplicationAutoScaling::ScalableTarget", @@ -95,4 +96,4 @@ } } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.expected.json b/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.expected.json index bd4f7aa45abdd..fe99c9db7c1ea 100644 --- a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.expected.json +++ b/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.expected.json @@ -20,7 +20,8 @@ "WriteCapacityUnits": 5 } }, - "DeletionPolicy": "Delete" + "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete" }, "TableWithGlobalAndLocalSecondaryIndexBC540710": { "Type": "AWS::DynamoDB::Table", @@ -269,7 +270,8 @@ "Enabled": true } }, - "DeletionPolicy": "Delete" + "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete" }, "TableWithGlobalSecondaryIndexCC8E841E": { "Type": "AWS::DynamoDB::Table", @@ -313,7 +315,8 @@ "WriteCapacityUnits": 5 } }, - "DeletionPolicy": "Delete" + "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete" }, "TableWithLocalSecondaryIndex4DA3D08F": { "Type": "AWS::DynamoDB::Table", @@ -365,7 +368,8 @@ "WriteCapacityUnits": 5 } }, - "DeletionPolicy": "Delete" + "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete" }, "User00B015A1": { "Type": "AWS::IAM::User" @@ -442,4 +446,4 @@ } } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.ondemand.expected.json b/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.ondemand.expected.json index 94b2f19fa5659..aa90dfcbda825 100644 --- a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.ondemand.expected.json +++ b/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.ondemand.expected.json @@ -17,7 +17,8 @@ ], "BillingMode": "PAY_PER_REQUEST" }, - "DeletionPolicy": "Delete" + "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete" }, "TableWithGlobalAndLocalSecondaryIndexBC540710": { "Type": "AWS::DynamoDB::Table", @@ -243,7 +244,8 @@ "Enabled": true } }, - "DeletionPolicy": "Delete" + "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete" }, "TableWithGlobalSecondaryIndexCC8E841E": { "Type": "AWS::DynamoDB::Table", @@ -280,7 +282,8 @@ } ] }, - "DeletionPolicy": "Delete" + "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete" }, "TableWithLocalSecondaryIndex4DA3D08F": { "Type": "AWS::DynamoDB::Table", @@ -329,7 +332,8 @@ } ] }, - "DeletionPolicy": "Delete" + "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete" } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/aws-ecr-assets/test/integ.assets-docker.expected.json b/packages/@aws-cdk/aws-ecr-assets/test/integ.assets-docker.expected.json index f39cae1e23b9c..b84802ba44251 100644 --- a/packages/@aws-cdk/aws-ecr-assets/test/integ.assets-docker.expected.json +++ b/packages/@aws-cdk/aws-ecr-assets/test/integ.assets-docker.expected.json @@ -45,7 +45,8 @@ "AdoptEcrRepositorydbc60defc59544bcaa5c28c95d68f62cServiceRoleDefaultPolicy6BC8737C", "AdoptEcrRepositorydbc60defc59544bcaa5c28c95d68f62cServiceRoleD788AA17" ], - "DeletionPolicy": "Delete" + "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete" }, "AdoptEcrRepositorydbc60defc59544bcaa5c28c95d68f62cServiceRoleD788AA17": { "Type": "AWS::IAM::Role", @@ -324,4 +325,4 @@ } } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/aws-ecr/test/integ.basic.expected.json b/packages/@aws-cdk/aws-ecr/test/integ.basic.expected.json index 55fa17cc6b50d..bc9110222d3c8 100644 --- a/packages/@aws-cdk/aws-ecr/test/integ.basic.expected.json +++ b/packages/@aws-cdk/aws-ecr/test/integ.basic.expected.json @@ -3,6 +3,7 @@ "Repo02AC86CF": { "Type": "AWS::ECR::Repository", "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain", "Properties": { "LifecyclePolicy": { "LifecyclePolicyText": "{\"rules\":[{\"rulePriority\":1,\"selection\":{\"tagStatus\":\"any\",\"countType\":\"imageCountMoreThan\",\"countNumber\":5},\"action\":{\"type\":\"expire\"}}]}" diff --git a/packages/@aws-cdk/aws-ecr/test/test.repository.ts b/packages/@aws-cdk/aws-ecr/test/test.repository.ts index cfb712013853b..6f97e3a4c5509 100644 --- a/packages/@aws-cdk/aws-ecr/test/test.repository.ts +++ b/packages/@aws-cdk/aws-ecr/test/test.repository.ts @@ -20,7 +20,8 @@ export = { Resources: { Repo02AC86CF: { Type: "AWS::ECR::Repository", - DeletionPolicy: "Retain" + DeletionPolicy: "Retain", + UpdateReplacePolicy: "Retain", } } }); diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.scheduled-ecs-task.lit.expected.json b/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.scheduled-ecs-task.lit.expected.json index 78be605b51dbd..d6c2ced309758 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.scheduled-ecs-task.lit.expected.json +++ b/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.scheduled-ecs-task.lit.expected.json @@ -718,7 +718,8 @@ }, "ScheduledEc2TaskScheduledTaskDefScheduledContainerLogGroupA85E11E6": { "Type": "AWS::Logs::LogGroup", - "DeletionPolicy": "Retain" + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" }, "ScheduledEc2TaskScheduledTaskDefExecutionRole65A8CC6F": { "Type": "AWS::IAM::Role", @@ -884,4 +885,4 @@ "Default": "/aws/service/ecs/optimized-ami/amazon-linux-2/recommended/image_id" } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.asset-image.expected.json b/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.asset-image.expected.json index 87dfe4da9093d..51979f83882c8 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.asset-image.expected.json +++ b/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.asset-image.expected.json @@ -348,7 +348,8 @@ }, "FargateServiceTaskDefwebLogGroup71FAF541": { "Type": "AWS::Logs::LogGroup", - "DeletionPolicy": "Retain" + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" }, "FargateServiceLBB353E155": { "Type": "AWS::ElasticLoadBalancingV2::LoadBalancer", @@ -658,7 +659,8 @@ "AdoptEcrRepositorydbc60defc59544bcaa5c28c95d68f62cServiceRoleDefaultPolicy6BC8737C", "AdoptEcrRepositorydbc60defc59544bcaa5c28c95d68f62cServiceRoleD788AA17" ], - "DeletionPolicy": "Delete" + "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete" }, "FargateServiceTaskDefExecutionRole9194820E": { "Type": "AWS::IAM::Role", diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.executionrole.expected.json b/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.executionrole.expected.json index f0f2ab36c64df..dff14f1ca0029 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.executionrole.expected.json +++ b/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.executionrole.expected.json @@ -598,7 +598,8 @@ }, "L3TaskDefwebLogGroupC6E4A38A": { "Type": "AWS::Logs::LogGroup", - "DeletionPolicy": "Retain" + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" }, "L3Service616D5A93": { "Type": "AWS::ECS::Service", diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3.expected.json b/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3.expected.json index fa8007a38d028..829b0cf2739d0 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3.expected.json +++ b/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3.expected.json @@ -585,7 +585,8 @@ }, "L3TaskDefwebLogGroupC6E4A38A": { "Type": "AWS::Logs::LogGroup", - "DeletionPolicy": "Retain" + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" }, "L3Service616D5A93": { "Type": "AWS::ECS::Service", diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.scheduled-fargate-task.lit.expected.json b/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.scheduled-fargate-task.lit.expected.json index d8b8dcff9ffe7..ac57faf50ef76 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.scheduled-fargate-task.lit.expected.json +++ b/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.scheduled-fargate-task.lit.expected.json @@ -437,11 +437,13 @@ "AdoptEcrRepositorydbc60defc59544bcaa5c28c95d68f62cServiceRoleDefaultPolicy6BC8737C", "AdoptEcrRepositorydbc60defc59544bcaa5c28c95d68f62cServiceRoleD788AA17" ], - "DeletionPolicy": "Delete" + "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete" }, "ScheduledFargateTaskScheduledTaskDefScheduledContainerLogGroup4134B16C": { "Type": "AWS::Logs::LogGroup", - "DeletionPolicy": "Retain" + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" }, "ScheduledFargateTaskScheduledTaskDefExecutionRoleD37356D5": { "Type": "AWS::IAM::Role", @@ -799,7 +801,8 @@ "physicalResourceId": "awsfargateintegScheduledFargateTaskScheduledTaskDefB0AD4F70" } }, - "DeletionPolicy": "Delete" + "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete" }, "AdoptEcrRepositorydbc60defc59544bcaa5c28c95d68f62cServiceRoleD788AA17": { "Type": "AWS::IAM::Role", diff --git a/packages/@aws-cdk/aws-events-targets/test/codepipeline/integ.pipeline-event-target.expected.json b/packages/@aws-cdk/aws-events-targets/test/codepipeline/integ.pipeline-event-target.expected.json index b993508c46936..0301408f8cc65 100644 --- a/packages/@aws-cdk/aws-events-targets/test/codepipeline/integ.pipeline-event-target.expected.json +++ b/packages/@aws-cdk/aws-events-targets/test/codepipeline/integ.pipeline-event-target.expected.json @@ -71,7 +71,8 @@ "Version": "2012-10-17" } }, - "DeletionPolicy": "Retain" + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" }, "pipelinePipeline22F2A91DArtifactsBucketC1799DCD": { "Type": "AWS::S3::Bucket", @@ -92,7 +93,8 @@ ] } }, - "DeletionPolicy": "Retain" + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" }, "pipelinePipeline22F2A91DRole58B7B05E": { "Type": "AWS::IAM::Role", @@ -473,4 +475,4 @@ } } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-ec2-task.lit.expected.json b/packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-ec2-task.lit.expected.json index 3a51383a460e8..c0d803733f47c 100644 --- a/packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-ec2-task.lit.expected.json +++ b/packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-ec2-task.lit.expected.json @@ -832,11 +832,13 @@ "AdoptEcrRepositorydbc60defc59544bcaa5c28c95d68f62cServiceRoleDefaultPolicy6BC8737C", "AdoptEcrRepositorydbc60defc59544bcaa5c28c95d68f62cServiceRoleD788AA17" ], - "DeletionPolicy": "Delete" + "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete" }, "TaskDefTheContainerLogGroupD94C8EF5": { "Type": "AWS::Logs::LogGroup", - "DeletionPolicy": "Retain" + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" }, "TaskDefExecutionRoleB4775C97": { "Type": "AWS::IAM::Role", diff --git a/packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-fargate-task.expected.json b/packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-fargate-task.expected.json index 654ac00374d93..2d436d8fd83dd 100644 --- a/packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-fargate-task.expected.json +++ b/packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-fargate-task.expected.json @@ -396,7 +396,8 @@ "AdoptEcrRepositorydbc60defc59544bcaa5c28c95d68f62cServiceRoleDefaultPolicy6BC8737C", "AdoptEcrRepositorydbc60defc59544bcaa5c28c95d68f62cServiceRoleD788AA17" ], - "DeletionPolicy": "Delete" + "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete" }, "TaskDefExecutionRoleB4775C97": { "Type": "AWS::IAM::Role", @@ -754,11 +755,13 @@ "physicalResourceId": "awsecsintegfargateTaskDef8878AF94" } }, - "DeletionPolicy": "Delete" + "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete" }, "TaskDefTheContainerLogGroupD94C8EF5": { "Type": "AWS::Logs::LogGroup", - "DeletionPolicy": "Retain" + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" }, "AdoptEcrRepositorydbc60defc59544bcaa5c28c95d68f62cServiceRoleD788AA17": { "Type": "AWS::IAM::Role", diff --git a/packages/@aws-cdk/aws-glue/test/integ.table.expected.json b/packages/@aws-cdk/aws-glue/test/integ.table.expected.json index 8d4f6a7793ea8..3dd33ba944c04 100644 --- a/packages/@aws-cdk/aws-glue/test/integ.table.expected.json +++ b/packages/@aws-cdk/aws-glue/test/integ.table.expected.json @@ -2,7 +2,8 @@ "Resources": { "MyDatabaseBucketCA6D21E6": { "Type": "AWS::S3::Bucket", - "DeletionPolicy": "Retain" + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" }, "MyDatabase1E2517DB": { "Type": "AWS::Glue::Database", @@ -29,7 +30,8 @@ }, "MyTableBucketD51E7EDC": { "Type": "AWS::S3::Bucket", - "DeletionPolicy": "Retain" + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" }, "MyTable85A92380": { "Type": "AWS::Glue::Table", @@ -164,7 +166,8 @@ "Version": "2012-10-17" } }, - "DeletionPolicy": "Retain" + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" }, "MyEncryptedTableBucket7B28486D": { "Type": "AWS::S3::Bucket", @@ -185,7 +188,8 @@ ] } }, - "DeletionPolicy": "Retain" + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" }, "MyEncryptedTable981A88C6": { "Type": "AWS::Glue::Table", diff --git a/packages/@aws-cdk/aws-glue/test/test.database.ts b/packages/@aws-cdk/aws-glue/test/test.database.ts index 40bae759f3268..30855b6e06a4a 100644 --- a/packages/@aws-cdk/aws-glue/test/test.database.ts +++ b/packages/@aws-cdk/aws-glue/test/test.database.ts @@ -15,7 +15,8 @@ export = { Resources: { DatabaseBucket318AF64F: { Type: 'AWS::S3::Bucket', - DeletionPolicy: "Retain" + DeletionPolicy: "Retain", + UpdateReplacePolicy: "Retain" }, DatabaseB269D8BB: { Type: 'AWS::Glue::Database', diff --git a/packages/@aws-cdk/aws-glue/test/test.table.ts b/packages/@aws-cdk/aws-glue/test/test.table.ts index 3b2a4cfecefae..6aebf4636d88a 100644 --- a/packages/@aws-cdk/aws-glue/test/test.table.ts +++ b/packages/@aws-cdk/aws-glue/test/test.table.ts @@ -28,7 +28,8 @@ export = { expect(tableStack).to(haveResource('AWS::S3::Bucket', { Type: "AWS::S3::Bucket", - DeletionPolicy: "Retain" + DeletionPolicy: "Retain", + UpdateReplacePolicy: "Retain" }, ResourcePart.CompleteDefinition)); expect(tableStack).to(haveResource('AWS::Glue::Table', { diff --git a/packages/@aws-cdk/aws-kinesis/test/test.stream.ts b/packages/@aws-cdk/aws-kinesis/test/test.stream.ts index 151d886b66fde..4b7c5fadadade 100644 --- a/packages/@aws-cdk/aws-kinesis/test/test.stream.ts +++ b/packages/@aws-cdk/aws-kinesis/test/test.stream.ts @@ -158,7 +158,8 @@ export = { "Version": "2012-10-17" } }, - "DeletionPolicy": "Retain" + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" }, "MyStream5C050E93": { "Type": "AWS::Kinesis::Stream", @@ -241,7 +242,8 @@ export = { "Version": "2012-10-17" } }, - "DeletionPolicy": "Retain" + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" }, "MyStream5C050E93": { "Type": "AWS::Kinesis::Stream", @@ -336,7 +338,8 @@ export = { "Version": "2012-10-17" } }, - "DeletionPolicy": "Retain" + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" }, "MyStream5C050E93": { "Type": "AWS::Kinesis::Stream", @@ -476,7 +479,8 @@ export = { "Version": "2012-10-17" } }, - "DeletionPolicy": "Retain" + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" }, "MyStream5C050E93": { "Type": "AWS::Kinesis::Stream", @@ -621,7 +625,8 @@ export = { "Version": "2012-10-17" } }, - "DeletionPolicy": "Retain" + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" }, "MyStream5C050E93": { "Type": "AWS::Kinesis::Stream", diff --git a/packages/@aws-cdk/aws-kms/test/integ.key-sharing.lit.expected.json b/packages/@aws-cdk/aws-kms/test/integ.key-sharing.lit.expected.json index 3d64434cc7749..28799650e7649 100644 --- a/packages/@aws-cdk/aws-kms/test/integ.key-sharing.lit.expected.json +++ b/packages/@aws-cdk/aws-kms/test/integ.key-sharing.lit.expected.json @@ -46,7 +46,8 @@ "Version": "2012-10-17" } }, - "DeletionPolicy": "Delete" + "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete" }, "MyKeyAlias1B45D9DA": { "Type": "AWS::KMS::Alias", @@ -63,4 +64,4 @@ } }, {} -] \ No newline at end of file +] diff --git a/packages/@aws-cdk/aws-kms/test/integ.key.expected.json b/packages/@aws-cdk/aws-kms/test/integ.key.expected.json index a1e41a2eca89e..aed6d40da371c 100644 --- a/packages/@aws-cdk/aws-kms/test/integ.key.expected.json +++ b/packages/@aws-cdk/aws-kms/test/integ.key.expected.json @@ -55,7 +55,8 @@ "Version": "2012-10-17" } }, - "DeletionPolicy": "Delete" + "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete" }, "MyKeyAlias1B45D9DA": { "Type": "AWS::KMS::Alias", @@ -70,4 +71,4 @@ } } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/aws-kms/test/test.key.ts b/packages/@aws-cdk/aws-kms/test/test.key.ts index 30a429c40b31f..47ebaa4a6b608 100644 --- a/packages/@aws-cdk/aws-kms/test/test.key.ts +++ b/packages/@aws-cdk/aws-kms/test/test.key.ts @@ -57,7 +57,8 @@ export = { Version: "2012-10-17" } }, - DeletionPolicy: "Retain" + DeletionPolicy: "Retain", + UpdateReplacePolicy: "Retain" } } })); @@ -70,7 +71,7 @@ export = { new Key(stack, 'MyKey', { removalPolicy: RemovalPolicy.DESTROY }); - expect(stack).to(haveResource('AWS::KMS::Key', { DeletionPolicy: "Delete" }, ResourcePart.CompleteDefinition)); + expect(stack).to(haveResource('AWS::KMS::Key', { DeletionPolicy: "Delete", UpdateReplacePolicy: "Delete" }, ResourcePart.CompleteDefinition)); test.done(); }, @@ -138,7 +139,8 @@ export = { Version: "2012-10-17" } }, - DeletionPolicy: "Retain" + DeletionPolicy: "Retain", + UpdateReplacePolicy: "Retain", } } })); @@ -232,7 +234,8 @@ export = { } ] }, - DeletionPolicy: "Retain" + DeletionPolicy: "Retain", + UpdateReplacePolicy: "Retain", } } })); @@ -301,7 +304,8 @@ export = { Version: "2012-10-17" } }, - DeletionPolicy: "Retain" + DeletionPolicy: "Retain", + UpdateReplacePolicy: "Retain", }, MyKeyAlias1B45D9DA: { Type: "AWS::KMS::Alias", diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.dynamodb.expected.json b/packages/@aws-cdk/aws-lambda-event-sources/test/integ.dynamodb.expected.json index ad443bb55d208..51e799cdf0691 100644 --- a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.dynamodb.expected.json +++ b/packages/@aws-cdk/aws-lambda-event-sources/test/integ.dynamodb.expected.json @@ -135,7 +135,8 @@ "StreamViewType": "NEW_IMAGE" } }, - "DeletionPolicy": "Delete" + "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete" } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.s3.expected.json b/packages/@aws-cdk/aws-lambda-event-sources/test/integ.s3.expected.json index ba1999bf6d136..9fa4ec5ff6f07 100644 --- a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.s3.expected.json +++ b/packages/@aws-cdk/aws-lambda-event-sources/test/integ.s3.expected.json @@ -84,6 +84,7 @@ }, "B08E7C7AF": { "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete", "Type": "AWS::S3::Bucket" }, "BNotificationsEB8DA980": { diff --git a/packages/@aws-cdk/aws-logs/test/integ.metricfilter.lit.expected.json b/packages/@aws-cdk/aws-logs/test/integ.metricfilter.lit.expected.json index 50e8fc5c2b174..0f44425a5f5b1 100644 --- a/packages/@aws-cdk/aws-logs/test/integ.metricfilter.lit.expected.json +++ b/packages/@aws-cdk/aws-logs/test/integ.metricfilter.lit.expected.json @@ -3,6 +3,7 @@ "LogGroupF5B46931": { "Type": "AWS::Logs::LogGroup", "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete", "Properties": { "RetentionInDays": 731 } diff --git a/packages/@aws-cdk/aws-logs/test/test.loggroup.ts b/packages/@aws-cdk/aws-logs/test/test.loggroup.ts index a66093405192e..b6c22b183d6cd 100644 --- a/packages/@aws-cdk/aws-logs/test/test.loggroup.ts +++ b/packages/@aws-cdk/aws-logs/test/test.loggroup.ts @@ -51,7 +51,8 @@ export = { Resources: { LogGroupF5B46931: { Type: "AWS::Logs::LogGroup", - DeletionPolicy: "Retain" + DeletionPolicy: "Retain", + UpdateReplacePolicy: "Retain" } } })); @@ -74,7 +75,8 @@ export = { Resources: { LogGroupF5B46931: { Type: "AWS::Logs::LogGroup", - DeletionPolicy: "Delete" + DeletionPolicy: "Delete", + UpdateReplacePolicy: "Delete" } } })); diff --git a/packages/@aws-cdk/aws-rds/test/integ.cluster.expected.json b/packages/@aws-cdk/aws-rds/test/integ.cluster.expected.json index 6f09d047317fe..27d4e5ed5bd54 100644 --- a/packages/@aws-cdk/aws-rds/test/integ.cluster.expected.json +++ b/packages/@aws-cdk/aws-rds/test/integ.cluster.expected.json @@ -398,7 +398,8 @@ "Version": "2012-10-17" } }, - "DeletionPolicy": "Retain" + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" }, "DatabaseSubnets56F17B9A": { "Type": "AWS::RDS::DBSubnetGroup", @@ -529,4 +530,4 @@ "UpdateReplacePolicy": "Retain" } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/aws-route53-targets/test/integ.cloudfront-alias-target.expected.json b/packages/@aws-cdk/aws-route53-targets/test/integ.cloudfront-alias-target.expected.json index 372a8eb65e47c..6881150f623e9 100644 --- a/packages/@aws-cdk/aws-route53-targets/test/integ.cloudfront-alias-target.expected.json +++ b/packages/@aws-cdk/aws-route53-targets/test/integ.cloudfront-alias-target.expected.json @@ -27,6 +27,7 @@ }, "Bucket83908E77": { "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete", "Type": "AWS::S3::Bucket" }, "MyDistributionCFDistributionDE147309": { diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment.expected.json b/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment.expected.json index 938f98b903eb5..47756b1a2d639 100644 --- a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment.expected.json +++ b/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment.expected.json @@ -7,7 +7,8 @@ "IndexDocument": "index.html" } }, - "DeletionPolicy": "Delete" + "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete" }, "DestinationPolicy7982387E": { "Type": "AWS::S3::BucketPolicy", @@ -91,7 +92,8 @@ }, "RetainOnDelete": false }, - "DeletionPolicy": "Delete" + "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete" }, "CustomCDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756CServiceRole89A01265": { "Type": "AWS::IAM::Role", @@ -356,7 +358,8 @@ }, "Destination281A09BDF": { "Type": "AWS::S3::Bucket", - "DeletionPolicy": "Retain" + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" }, "DeployWithPrefixCustomResource9CF7C694": { "Type": "Custom::CDKBucketDeployment", @@ -409,7 +412,8 @@ "DestinationBucketKeyPrefix": "deploy/here/", "RetainOnDelete": false }, - "DeletionPolicy": "Delete" + "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete" } }, "Parameters": { @@ -450,4 +454,4 @@ "Description": "Artifact hash for asset \"test-bucket-deployments-1/DeployWithPrefix/Asset\"" } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/aws-s3-notifications/test/integ.notifications.expected.json b/packages/@aws-cdk/aws-s3-notifications/test/integ.notifications.expected.json index 9b7bb66066352..865e840316c65 100644 --- a/packages/@aws-cdk/aws-s3-notifications/test/integ.notifications.expected.json +++ b/packages/@aws-cdk/aws-s3-notifications/test/integ.notifications.expected.json @@ -2,6 +2,7 @@ "Resources": { "Bucket83908E77": { "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete", "Type": "AWS::S3::Bucket" }, "BucketNotifications8F2E257D": { @@ -265,6 +266,7 @@ }, "Bucket25524B414": { "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete", "Type": "AWS::S3::Bucket" }, "Bucket2NotificationsD9BA2A77": { @@ -312,4 +314,4 @@ ] } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/aws-s3-notifications/test/lambda/integ.bucket-notifications.expected.json b/packages/@aws-cdk/aws-s3-notifications/test/lambda/integ.bucket-notifications.expected.json index 73e1aaa046e7e..e04c417c1b76e 100644 --- a/packages/@aws-cdk/aws-s3-notifications/test/lambda/integ.bucket-notifications.expected.json +++ b/packages/@aws-cdk/aws-s3-notifications/test/lambda/integ.bucket-notifications.expected.json @@ -2,6 +2,7 @@ "Resources": { "MyBucketF68F3FF0": { "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete", "Type": "AWS::S3::Bucket" }, "MyBucketNotifications46AC0CD2": { @@ -152,6 +153,7 @@ }, "YourBucketC6A57364": { "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete", "Type": "AWS::S3::Bucket" }, "YourBucketNotifications8D39901A": { @@ -267,4 +269,4 @@ } } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/aws-s3-notifications/test/notifications.test.ts b/packages/@aws-cdk/aws-s3-notifications/test/notifications.test.ts index 05f547c7c67a3..e1fa4330a03a2 100644 --- a/packages/@aws-cdk/aws-s3-notifications/test/notifications.test.ts +++ b/packages/@aws-cdk/aws-s3-notifications/test/notifications.test.ts @@ -18,7 +18,8 @@ test('bucket without notifications', () => { "Resources": { "MyBucketF68F3FF0": { "Type": "AWS::S3::Bucket", - "DeletionPolicy": "Retain" + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" } } }); diff --git a/packages/@aws-cdk/aws-s3-notifications/test/sns.test.ts b/packages/@aws-cdk/aws-s3-notifications/test/sns.test.ts index 9c76c05eae7de..fb04b981b1929 100644 --- a/packages/@aws-cdk/aws-s3-notifications/test/sns.test.ts +++ b/packages/@aws-cdk/aws-s3-notifications/test/sns.test.ts @@ -21,10 +21,12 @@ test('asBucketNotificationDestination adds bucket permissions only once for each Bucket83908E77: { Type: "AWS::S3::Bucket", DeletionPolicy: "Retain", + UpdateReplacePolicy: "Retain", }, Bucket25524B414: { Type: "AWS::S3::Bucket", DeletionPolicy: "Retain", + UpdateReplacePolicy: "Retain", }, MyTopic86869434: { Type: "AWS::SNS::Topic" @@ -78,4 +80,4 @@ test('asBucketNotificationDestination adds bucket permissions only once for each } } }); -}); \ No newline at end of file +}); diff --git a/packages/@aws-cdk/aws-s3-notifications/test/sns/integ.sns-bucket-notifications.expected.json b/packages/@aws-cdk/aws-s3-notifications/test/sns/integ.sns-bucket-notifications.expected.json index ec5c5ae7f71e9..e94ea8729a5f2 100644 --- a/packages/@aws-cdk/aws-s3-notifications/test/sns/integ.sns-bucket-notifications.expected.json +++ b/packages/@aws-cdk/aws-s3-notifications/test/sns/integ.sns-bucket-notifications.expected.json @@ -100,6 +100,7 @@ }, "MyBucketF68F3FF0": { "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete", "Type": "AWS::S3::Bucket" }, "MyBucketNotifications46AC0CD2": { @@ -237,4 +238,4 @@ } } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/aws-s3-notifications/test/sqs/integ.bucket-notifications.expected.json b/packages/@aws-cdk/aws-s3-notifications/test/sqs/integ.bucket-notifications.expected.json index 74b7ef9728947..87b9073be6f6b 100644 --- a/packages/@aws-cdk/aws-s3-notifications/test/sqs/integ.bucket-notifications.expected.json +++ b/packages/@aws-cdk/aws-s3-notifications/test/sqs/integ.bucket-notifications.expected.json @@ -2,6 +2,7 @@ "Resources": { "Bucket12520700A": { "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete", "Type": "AWS::S3::Bucket" }, "Bucket1NotificationsBC5D9A45": { @@ -225,6 +226,7 @@ }, "Bucket25524B414": { "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete", "Type": "AWS::S3::Bucket" }, "Bucket2NotificationsD9BA2A77": { @@ -369,7 +371,8 @@ }, "Description": "Created by sqs-bucket-notifications/EncryptedQueue" }, - "DeletionPolicy": "Retain" + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" }, "EncryptedQueue0428C61A": { "Type": "AWS::SQS::Queue", diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-sharing.lit.expected.json b/packages/@aws-cdk/aws-s3/test/integ.bucket-sharing.lit.expected.json index c7eefed3a4520..847d7444213fd 100644 --- a/packages/@aws-cdk/aws-s3/test/integ.bucket-sharing.lit.expected.json +++ b/packages/@aws-cdk/aws-s3/test/integ.bucket-sharing.lit.expected.json @@ -3,6 +3,7 @@ "Resources": { "MyBucketF68F3FF0": { "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete", "Type": "AWS::S3::Bucket" } }, diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket.domain-name.expected.json b/packages/@aws-cdk/aws-s3/test/integ.bucket.domain-name.expected.json index a823f27281c01..69e415c8c2683 100644 --- a/packages/@aws-cdk/aws-s3/test/integ.bucket.domain-name.expected.json +++ b/packages/@aws-cdk/aws-s3/test/integ.bucket.domain-name.expected.json @@ -2,6 +2,7 @@ "Resources": { "MyBucketF68F3FF0": { "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete", "Type": "AWS::S3::Bucket" } }, @@ -28,4 +29,4 @@ } } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket.expected.json b/packages/@aws-cdk/aws-s3/test/integ.bucket.expected.json index 70f427a6a8a34..d3120db6921cf 100644 --- a/packages/@aws-cdk/aws-s3/test/integ.bucket.expected.json +++ b/packages/@aws-cdk/aws-s3/test/integ.bucket.expected.json @@ -65,11 +65,13 @@ }, "Description": "Created by aws-cdk-s3/MyBucket" }, - "DeletionPolicy": "Retain" + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" }, "MyBucketF68F3FF0": { "Type": "AWS::S3::Bucket", "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete", "Properties": { "BucketEncryption": { "ServerSideEncryptionConfiguration": [ @@ -91,6 +93,7 @@ "MyOtherBucket543F3540": { "Type": "AWS::S3::Bucket", "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete", "Properties": { "BucketEncryption": { "ServerSideEncryptionConfiguration": [ diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket.url.lit.expected.json b/packages/@aws-cdk/aws-s3/test/integ.bucket.url.lit.expected.json index 3a56b818acbce..db4685f11a399 100644 --- a/packages/@aws-cdk/aws-s3/test/integ.bucket.url.lit.expected.json +++ b/packages/@aws-cdk/aws-s3/test/integ.bucket.url.lit.expected.json @@ -2,7 +2,8 @@ "Resources": { "MyBucketF68F3FF0": { "Type": "AWS::S3::Bucket", - "DeletionPolicy": "Delete" + "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete" } }, "Outputs": { @@ -37,4 +38,4 @@ } } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/aws-s3/test/integ.lifecycle.expected.json b/packages/@aws-cdk/aws-s3/test/integ.lifecycle.expected.json index 47a22903017c3..1b4955a9645ed 100644 --- a/packages/@aws-cdk/aws-s3/test/integ.lifecycle.expected.json +++ b/packages/@aws-cdk/aws-s3/test/integ.lifecycle.expected.json @@ -3,6 +3,7 @@ "MyBucketF68F3FF0": { "Type": "AWS::S3::Bucket", "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete", "Properties": { "LifecycleConfiguration": { "Rules": [ @@ -15,4 +16,4 @@ } } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/aws-s3/test/test.bucket.ts b/packages/@aws-cdk/aws-s3/test/test.bucket.ts index b9ca7f88f6b2e..89e3cab52c610 100644 --- a/packages/@aws-cdk/aws-s3/test/test.bucket.ts +++ b/packages/@aws-cdk/aws-s3/test/test.bucket.ts @@ -22,6 +22,7 @@ export = { "MyBucketF68F3FF0": { "Type": "AWS::S3::Bucket", "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain", } } }); @@ -53,6 +54,7 @@ export = { "MyBucketF68F3FF0": { "Type": "AWS::S3::Bucket", "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain", } } }); @@ -82,6 +84,7 @@ export = { } }, "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain", } } }); @@ -303,7 +306,8 @@ export = { "Version": "2012-10-17" } }, - "DeletionPolicy": "Retain" + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" }, "MyBucketF68F3FF0": { "Type": "AWS::S3::Bucket", @@ -325,6 +329,7 @@ export = { } }, "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain", } } }); @@ -347,6 +352,7 @@ export = { } }, "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain", } } }); @@ -372,6 +378,7 @@ export = { } }, "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain", } } }); @@ -395,6 +402,7 @@ export = { } }, "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain", } } }); @@ -417,6 +425,7 @@ export = { } }, "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain", } } }); @@ -436,6 +445,7 @@ export = { "MyBucketF68F3FF0": { "Type": "AWS::S3::Bucket", "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain", }, "MyBucketPolicyE7FBAC7B": { "Type": "AWS::S3::BucketPolicy", @@ -543,7 +553,8 @@ export = { Resources: { MyBucketF68F3FF0: { Type: 'AWS::S3::Bucket', - DeletionPolicy: 'Retain' + DeletionPolicy: 'Retain', + UpdateReplacePolicy: 'Retain' } } }); @@ -684,7 +695,8 @@ export = { }, "MyBucketF68F3FF0": { "Type": "AWS::S3::Bucket", - "DeletionPolicy": "Retain" + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" }, } }); @@ -703,6 +715,7 @@ export = { "MyBucketF68F3FF0": { "Type": "AWS::S3::Bucket", "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain", }, "MyUserDC45028B": { "Type": "AWS::IAM::User" @@ -894,11 +907,13 @@ export = { "Version": "2012-10-17" } }, - "DeletionPolicy": "Retain" + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" }, "MyBucketF68F3FF0": { "Type": "AWS::S3::Bucket", "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain", "Properties": { "BucketEncryption": { "ServerSideEncryptionConfiguration": [ @@ -1026,7 +1041,8 @@ export = { "Resources": { "MyBucketF68F3FF0": { "Type": "AWS::S3::Bucket", - "DeletionPolicy": "Retain" + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" } }, "Outputs": { @@ -1270,7 +1286,8 @@ export = { "Resources": { "MyBucketF68F3FF0": { "Type": "AWS::S3::Bucket", - "DeletionPolicy": "Retain" + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" } }, "Outputs": { diff --git a/packages/@aws-cdk/aws-ses/test/integ.receipt.expected.json b/packages/@aws-cdk/aws-ses/test/integ.receipt.expected.json index 24acd6873532f..0436e0648f572 100644 --- a/packages/@aws-cdk/aws-ses/test/integ.receipt.expected.json +++ b/packages/@aws-cdk/aws-ses/test/integ.receipt.expected.json @@ -81,7 +81,8 @@ }, "Bucket83908E77": { "Type": "AWS::S3::Bucket", - "DeletionPolicy": "Retain" + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" }, "BucketPolicyE9A3008A": { "Type": "AWS::S3::BucketPolicy", @@ -211,7 +212,8 @@ "Version": "2012-10-17" } }, - "DeletionPolicy": "Retain" + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" }, "RuleSetE30C6C48": { "Type": "AWS::SES::ReceiptRuleSet" diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.ec2-task.expected.json b/packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.ec2-task.expected.json index 300bead009820..e98a6431c534e 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.ec2-task.expected.json +++ b/packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.ec2-task.expected.json @@ -614,11 +614,13 @@ "AdoptEcrRepositorydbc60defc59544bcaa5c28c95d68f62cServiceRoleDefaultPolicy6BC8737C", "AdoptEcrRepositorydbc60defc59544bcaa5c28c95d68f62cServiceRoleD788AA17" ], - "DeletionPolicy": "Delete" + "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete" }, "TaskDefTheContainerLogGroupD94C8EF5": { "Type": "AWS::Logs::LogGroup", - "DeletionPolicy": "Retain" + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" }, "TaskDefExecutionRoleB4775C97": { "Type": "AWS::IAM::Role", diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.fargate-task.expected.json b/packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.fargate-task.expected.json index 9759d6be40421..e1a400ded6bea 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.fargate-task.expected.json +++ b/packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.fargate-task.expected.json @@ -189,7 +189,8 @@ "AdoptEcrRepositorydbc60defc59544bcaa5c28c95d68f62cServiceRoleDefaultPolicy6BC8737C", "AdoptEcrRepositorydbc60defc59544bcaa5c28c95d68f62cServiceRoleD788AA17" ], - "DeletionPolicy": "Delete" + "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete" }, "TaskDefExecutionRoleB4775C97": { "Type": "AWS::IAM::Role", @@ -280,7 +281,8 @@ }, "TaskDefTheContainerLogGroupD94C8EF5": { "Type": "AWS::Logs::LogGroup", - "DeletionPolicy": "Retain" + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" }, "AdoptEcrRepositorydbc60defc59544bcaa5c28c95d68f62cServiceRoleD788AA17": { "Type": "AWS::IAM::Role", diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.sagemaker.expected.json b/packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.sagemaker.expected.json index 55c8ee820af8b..f489c0c180f93 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.sagemaker.expected.json +++ b/packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.sagemaker.expected.json @@ -78,7 +78,8 @@ "Version": "2012-10-17" } }, - "DeletionPolicy": "Delete" + "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete" }, "TrainingData3FDB6D34": { "Type": "AWS::S3::Bucket", @@ -99,7 +100,8 @@ ] } }, - "DeletionPolicy": "Delete" + "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete" }, "SagemakerRole5FDB64E1": { "Type": "AWS::IAM::Role", @@ -396,4 +398,4 @@ } } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/core/lib/cfn-resource.ts b/packages/@aws-cdk/core/lib/cfn-resource.ts index 31dc062f5ce43..c958f45b6001d 100644 --- a/packages/@aws-cdk/core/lib/cfn-resource.ts +++ b/packages/@aws-cdk/core/lib/cfn-resource.ts @@ -120,7 +120,7 @@ export class CfnResource extends CfnRefElement { } this.cfnOptions.deletionPolicy = deletionPolicy; - if (options.applyToUpdateReplacePolicy) { + if (options.applyToUpdateReplacePolicy !== false) { this.cfnOptions.updateReplacePolicy = deletionPolicy; } } diff --git a/packages/@aws-cdk/core/lib/removal-policy.ts b/packages/@aws-cdk/core/lib/removal-policy.ts index 363c506661945..e8ad5a8da24eb 100644 --- a/packages/@aws-cdk/core/lib/removal-policy.ts +++ b/packages/@aws-cdk/core/lib/removal-policy.ts @@ -22,7 +22,7 @@ export interface RemovalPolicyOptions { /** * Apply the same deletion policy to the resource's "UpdateReplacePolicy" - * @default false + * @default true */ readonly applyToUpdateReplacePolicy?: boolean; } diff --git a/packages/@aws-cdk/core/test/test.resource.ts b/packages/@aws-cdk/core/test/test.resource.ts index 92cab3f7df156..ce85b6b86c61a 100644 --- a/packages/@aws-cdk/core/test/test.resource.ts +++ b/packages/@aws-cdk/core/test/test.resource.ts @@ -306,10 +306,10 @@ export = { test.deepEqual(toCloudFormation(stack), { Resources: { - Retain: { Type: 'T1', DeletionPolicy: 'Retain' }, - Destroy: { Type: 'T3', DeletionPolicy: 'Delete' }, - Default1: { Type: 'T4', DeletionPolicy: 'Delete' }, // explicit default - Default2: { Type: 'T4', DeletionPolicy: 'Retain' } // implicit default + Retain: { Type: 'T1', DeletionPolicy: 'Retain', UpdateReplacePolicy: 'Retain' }, + Destroy: { Type: 'T3', DeletionPolicy: 'Delete', UpdateReplacePolicy: 'Delete' }, + Default1: { Type: 'T4', DeletionPolicy: 'Delete', UpdateReplacePolicy: 'Delete' }, // explicit default + Default2: { Type: 'T4', DeletionPolicy: 'Retain', UpdateReplacePolicy: 'Retain' } // implicit default } }); test.done(); diff --git a/packages/@aws-cdk/custom-resources/test/integ.aws-custom-resource.expected.json b/packages/@aws-cdk/custom-resources/test/integ.aws-custom-resource.expected.json index a045f44eb5acb..96cc6253f4dcf 100644 --- a/packages/@aws-cdk/custom-resources/test/integ.aws-custom-resource.expected.json +++ b/packages/@aws-cdk/custom-resources/test/integ.aws-custom-resource.expected.json @@ -39,7 +39,8 @@ } } }, - "DeletionPolicy": "Delete" + "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete" }, "AWS679f53fac002430cb0da5b7982bd2287ServiceRoleC1EA0FF2": { "Type": "AWS::IAM::Role", @@ -191,7 +192,8 @@ "DependsOn": [ "TopicBFC7AF6E" ], - "DeletionPolicy": "Delete" + "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete" }, "DummyParameter53662B67": { "Type": "AWS::SSM::Parameter", @@ -232,7 +234,8 @@ "physicalResourceIdPath": "Parameter.ARN" } }, - "DeletionPolicy": "Delete" + "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete" } }, "Parameters": { @@ -275,4 +278,4 @@ } } } -} \ No newline at end of file +} diff --git a/packages/aws-cdk/lib/init-templates/app/java/src/test/resources/com/myorg/expected.cfn.json b/packages/aws-cdk/lib/init-templates/app/java/src/test/resources/com/myorg/expected.cfn.json index 98159f70a67e4..bd5b118bfa94e 100644 --- a/packages/aws-cdk/lib/init-templates/app/java/src/test/resources/com/myorg/expected.cfn.json +++ b/packages/aws-cdk/lib/init-templates/app/java/src/test/resources/com/myorg/expected.cfn.json @@ -64,23 +64,28 @@ }, "BucketsBucket04F23AD6D": { "Type": "AWS::S3::Bucket", - "DeletionPolicy": "Retain" + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" }, "BucketsBucket1B98A5B53": { "Type": "AWS::S3::Bucket", - "DeletionPolicy": "Retain" + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" }, "BucketsBucket237F4E9C5": { "Type": "AWS::S3::Bucket", - "DeletionPolicy": "Retain" + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" }, "BucketsBucket351AD8978": { "Type": "AWS::S3::Bucket", - "DeletionPolicy": "Retain" + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" }, "BucketsBucket4AEE1AAD9": { "Type": "AWS::S3::Bucket", - "DeletionPolicy": "Retain" + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" }, "MyUserDC45028B": { "Type": "AWS::IAM::User" @@ -252,4 +257,4 @@ } } } -} \ No newline at end of file +} diff --git a/packages/cdk-dasm/test/bucket-key.json b/packages/cdk-dasm/test/bucket-key.json index 09446c601edf0..840d9d99e137f 100644 --- a/packages/cdk-dasm/test/bucket-key.json +++ b/packages/cdk-dasm/test/bucket-key.json @@ -47,6 +47,7 @@ "Description": "Created by Pg12321Stack/MyBucket" }, "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain", "Metadata": { "aws:cdk:path": "Pg12321Stack/MyBucket/Key/Resource" } @@ -71,6 +72,7 @@ } }, "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain", "Metadata": { "aws:cdk:path": "Pg12321Stack/MyBucket/Resource" } @@ -82,4 +84,4 @@ } } } -} \ No newline at end of file +} diff --git a/packages/decdk/test/__snapshots__/synth.test.js.snap b/packages/decdk/test/__snapshots__/synth.test.js.snap index cb21a35759b02..386af611fb0c2 100644 --- a/packages/decdk/test/__snapshots__/synth.test.js.snap +++ b/packages/decdk/test/__snapshots__/synth.test.js.snap @@ -1345,6 +1345,7 @@ Object { }, }, "Type": "AWS::DynamoDB::Table", + "UpdateReplacePolicy": "Retain", }, "lambdaeventsHelloWorldFunctionAB27BB65ApiEventSourceA7A86A4F12449C5F": Object { "Properties": Object { @@ -1942,6 +1943,7 @@ Object { }, }, "Type": "AWS::KMS::Key", + "UpdateReplacePolicy": "Retain", }, "PipelineArtifactsBucket22248F97": Object { "DeletionPolicy": "Retain", @@ -1963,6 +1965,7 @@ Object { }, }, "Type": "AWS::S3::Bucket", + "UpdateReplacePolicy": "Retain", }, "PipelineArtifactsBucketEncryptionKey01D58D69": Object { "DeletionPolicy": "Retain", @@ -2083,6 +2086,7 @@ Object { }, }, "Type": "AWS::KMS::Key", + "UpdateReplacePolicy": "Retain", }, "PipelineBuildCodePipelineActionRoleD77A08E6": Object { "Properties": Object { @@ -2931,6 +2935,7 @@ Object { }, }, "Type": "AWS::KMS::Key", + "UpdateReplacePolicy": "Retain", }, }, } From e924bf2b3ea2ec4bc5d75c13b1a1fb029e7af71c Mon Sep 17 00:00:00 2001 From: Rico Huijbers Date: Sun, 7 Jul 2019 10:15:38 +0200 Subject: [PATCH 2/2] Add unit tests --- .../@aws-cdk/core/test/test.cfn-resource.ts | 49 ++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/packages/@aws-cdk/core/test/test.cfn-resource.ts b/packages/@aws-cdk/core/test/test.cfn-resource.ts index db83634ecccd3..02bd72b82c2bb 100644 --- a/packages/@aws-cdk/core/test/test.cfn-resource.ts +++ b/packages/@aws-cdk/core/test/test.cfn-resource.ts @@ -25,5 +25,52 @@ export = nodeunit.testCase({ test.done(); } - } + }, + + 'applyRemovalPolicy default includes Update policy'(test: nodeunit.Test) { + // GIVEN + const app = new core.App(); + const stack = new core.Stack(app, 'TestStack'); + const resource = new core.CfnResource(stack, 'DefaultResource', { type: 'Test::Resource::Fake' }); + + // WHEN + resource.applyRemovalPolicy(core.RemovalPolicy.RETAIN); + + // THEN + test.deepEqual(app.synth().getStack(stack.stackName).template, { + Resources: { + DefaultResource: { + Type: 'Test::Resource::Fake', + DeletionPolicy: 'Retain', + UpdateReplacePolicy: 'Retain', + } + } + }); + + test.done(); + }, + + 'can switch off updating Update policy'(test: nodeunit.Test) { + // GIVEN + const app = new core.App(); + const stack = new core.Stack(app, 'TestStack'); + const resource = new core.CfnResource(stack, 'DefaultResource', { type: 'Test::Resource::Fake' }); + + // WHEN + resource.applyRemovalPolicy(core.RemovalPolicy.RETAIN, { + applyToUpdateReplacePolicy: false + }); + + // THEN + test.deepEqual(app.synth().getStack(stack.stackName).template, { + Resources: { + DefaultResource: { + Type: 'Test::Resource::Fake', + DeletionPolicy: 'Retain', + } + } + }); + + test.done(); + }, });