Skip to content

Commit 228901a

Browse files
authored
fix(s3): auto-delete-objects fails when bucket doesn't exist (#26433)
The AutoDeleteObjects Custom Resource should pass when the bucket doesn't exist. With #16756 we introduced a safety check to only delete buckets that are marked for object-deletion. This check would unintentionally bypass the special case to mark the CR deletion as successful when the bucket doesn't exist. Additionally, with the upgrade to SDK v3 we need to change the check from `error.code` to check for the actual error instance. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 47f15a6 commit 228901a

File tree

176 files changed

+10289
-4987
lines changed

Some content is hidden

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

176 files changed

+10289
-4987
lines changed

packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/cloudformation/integ.stacksets.js.snapshot/StackSetPipelineStack.assets.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{
22
"version": "32.0.0",
33
"files": {
4-
"89c643a8a6c919d906e0b1cb079b0c5e131cf3cc19c05126f90fc118647fb08c": {
4+
"216218e507a977a1bb3592f29c1a62ab3e0a9eb25569109a395315638e154329": {
55
"source": {
6-
"path": "asset.89c643a8a6c919d906e0b1cb079b0c5e131cf3cc19c05126f90fc118647fb08c",
6+
"path": "asset.216218e507a977a1bb3592f29c1a62ab3e0a9eb25569109a395315638e154329",
77
"packaging": "zip"
88
},
99
"destinations": {
1010
"current_account-current_region": {
1111
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
12-
"objectKey": "89c643a8a6c919d906e0b1cb079b0c5e131cf3cc19c05126f90fc118647fb08c.zip",
12+
"objectKey": "216218e507a977a1bb3592f29c1a62ab3e0a9eb25569109a395315638e154329.zip",
1313
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
1414
}
1515
}
@@ -27,15 +27,15 @@
2727
}
2828
}
2929
},
30-
"03976f19a1ccfcbacb9ef3d50473b535965747dcfb46bad6966e5da8ccc9b35b": {
30+
"05ade89a272158845b639cd0b4928c2443b24c71c37e71c0b82096c1dfe322a2": {
3131
"source": {
3232
"path": "StackSetPipelineStack.template.json",
3333
"packaging": "file"
3434
},
3535
"destinations": {
3636
"current_account-current_region": {
3737
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
38-
"objectKey": "03976f19a1ccfcbacb9ef3d50473b535965747dcfb46bad6966e5da8ccc9b35b.json",
38+
"objectKey": "05ade89a272158845b639cd0b4928c2443b24c71c37e71c0b82096c1dfe322a2.json",
3939
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
4040
}
4141
}

packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/cloudformation/integ.stacksets.js.snapshot/StackSetPipelineStack.template.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@
112112
"S3Bucket": {
113113
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
114114
},
115-
"S3Key": "89c643a8a6c919d906e0b1cb079b0c5e131cf3cc19c05126f90fc118647fb08c.zip"
115+
"S3Key": "216218e507a977a1bb3592f29c1a62ab3e0a9eb25569109a395315638e154329.zip"
116116
},
117117
"Timeout": 900,
118118
"MemorySize": 128,
@@ -238,6 +238,12 @@
238238
"PipelineC660917D": {
239239
"Type": "AWS::CodePipeline::Pipeline",
240240
"Properties": {
241+
"ArtifactStore": {
242+
"Location": {
243+
"Ref": "ArtifactBucket7410C9EF"
244+
},
245+
"Type": "S3"
246+
},
241247
"RoleArn": {
242248
"Fn::GetAtt": [
243249
"PipelineRoleD68726F7",
@@ -337,13 +343,7 @@
337343
],
338344
"Name": "Cfn"
339345
}
340-
],
341-
"ArtifactStore": {
342-
"Location": {
343-
"Ref": "ArtifactBucket7410C9EF"
344-
},
345-
"Type": "S3"
346-
}
346+
]
347347
},
348348
"DependsOn": [
349349
"PipelineRoleDefaultPolicyC7A05455",

packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/cloudformation/integ.stacksets.js.snapshot/asset.216218e507a977a1bb3592f29c1a62ab3e0a9eb25569109a395315638e154329/index.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/cloudformation/integ.stacksets.js.snapshot/asset.89c643a8a6c919d906e0b1cb079b0c5e131cf3cc19c05126f90fc118647fb08c/index.js

Lines changed: 0 additions & 2 deletions
This file was deleted.

packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/cloudformation/integ.stacksets.js.snapshot/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"validateOnSynth": false,
1818
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}",
1919
"cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}",
20-
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/03976f19a1ccfcbacb9ef3d50473b535965747dcfb46bad6966e5da8ccc9b35b.json",
20+
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/05ade89a272158845b639cd0b4928c2443b24c71c37e71c0b82096c1dfe322a2.json",
2121
"requiresBootstrapStackVersion": 6,
2222
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version",
2323
"additionalDependencies": [

packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/cloudformation/integ.stacksets.js.snapshot/tree.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,12 @@
306306
"attributes": {
307307
"aws:cdk:cloudformation:type": "AWS::CodePipeline::Pipeline",
308308
"aws:cdk:cloudformation:props": {
309+
"artifactStore": {
310+
"type": "S3",
311+
"location": {
312+
"Ref": "ArtifactBucket7410C9EF"
313+
}
314+
},
309315
"roleArn": {
310316
"Fn::GetAtt": [
311317
"PipelineRoleD68726F7",
@@ -405,13 +411,7 @@
405411
}
406412
]
407413
}
408-
],
409-
"artifactStore": {
410-
"type": "S3",
411-
"location": {
412-
"Ref": "ArtifactBucket7410C9EF"
413-
}
414-
}
414+
]
415415
}
416416
},
417417
"constructInfo": {

packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeilne-elastic-beanstalk-deploy.js.snapshot/aws-cdk-codepipeline-elastic-beanstalk-deploy.assets.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{
22
"version": "32.0.0",
33
"files": {
4-
"89c643a8a6c919d906e0b1cb079b0c5e131cf3cc19c05126f90fc118647fb08c": {
4+
"216218e507a977a1bb3592f29c1a62ab3e0a9eb25569109a395315638e154329": {
55
"source": {
6-
"path": "asset.89c643a8a6c919d906e0b1cb079b0c5e131cf3cc19c05126f90fc118647fb08c",
6+
"path": "asset.216218e507a977a1bb3592f29c1a62ab3e0a9eb25569109a395315638e154329",
77
"packaging": "zip"
88
},
99
"destinations": {
1010
"current_account-current_region": {
1111
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
12-
"objectKey": "89c643a8a6c919d906e0b1cb079b0c5e131cf3cc19c05126f90fc118647fb08c.zip",
12+
"objectKey": "216218e507a977a1bb3592f29c1a62ab3e0a9eb25569109a395315638e154329.zip",
1313
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
1414
}
1515
}
@@ -53,15 +53,15 @@
5353
}
5454
}
5555
},
56-
"ae905796f14ca862d4e6f19382d8b2aae475b34b7c2395bd8fea7789d31809c6": {
56+
"c7f8ee5d9578c611b742c0b6a8bd6f94191be5d73984891ef4dbecc336be1be3": {
5757
"source": {
5858
"path": "aws-cdk-codepipeline-elastic-beanstalk-deploy.template.json",
5959
"packaging": "file"
6060
},
6161
"destinations": {
6262
"current_account-current_region": {
6363
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
64-
"objectKey": "ae905796f14ca862d4e6f19382d8b2aae475b34b7c2395bd8fea7789d31809c6.json",
64+
"objectKey": "c7f8ee5d9578c611b742c0b6a8bd6f94191be5d73984891ef4dbecc336be1be3.json",
6565
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
6666
}
6767
}

packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeilne-elastic-beanstalk-deploy.js.snapshot/aws-cdk-codepipeline-elastic-beanstalk-deploy.template.json

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@
119119
"S3Bucket": {
120120
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
121121
},
122-
"S3Key": "89c643a8a6c919d906e0b1cb079b0c5e131cf3cc19c05126f90fc118647fb08c.zip"
122+
"S3Key": "216218e507a977a1bb3592f29c1a62ab3e0a9eb25569109a395315638e154329.zip"
123123
},
124124
"Timeout": 900,
125125
"MemorySize": 128,
@@ -320,12 +320,6 @@
320320
},
321321
"S3Key": "9eb41a5505d37607ac419321497a4f8c21cf0ee1f9b4a6b29aa04301aea5c7fd.zip"
322322
},
323-
"Role": {
324-
"Fn::GetAtt": [
325-
"CustomCDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756CServiceRole89A01265",
326-
"Arn"
327-
]
328-
},
329323
"Environment": {
330324
"Variables": {
331325
"AWS_CA_BUNDLE": "/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem"
@@ -337,6 +331,12 @@
337331
"Ref": "DeployAppAwsCliLayerAEF99B2F"
338332
}
339333
],
334+
"Role": {
335+
"Fn::GetAtt": [
336+
"CustomCDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756CServiceRole89A01265",
337+
"Arn"
338+
]
339+
},
340340
"Runtime": "python3.9",
341341
"Timeout": 900
342342
},
@@ -393,14 +393,14 @@
393393
"instanceprofile": {
394394
"Type": "AWS::IAM::InstanceProfile",
395395
"Properties": {
396+
"InstanceProfileName": {
397+
"Ref": "instanceprofilerole786BCBC7"
398+
},
396399
"Roles": [
397400
{
398401
"Ref": "instanceprofilerole786BCBC7"
399402
}
400-
],
401-
"InstanceProfileName": {
402-
"Ref": "instanceprofilerole786BCBC7"
403-
}
403+
]
404404
}
405405
},
406406
"beastalkapp": {
@@ -538,6 +538,12 @@
538538
"PipelineC660917D": {
539539
"Type": "AWS::CodePipeline::Pipeline",
540540
"Properties": {
541+
"ArtifactStore": {
542+
"Location": {
543+
"Ref": "PipelineBucketB967BD35"
544+
},
545+
"Type": "S3"
546+
},
541547
"RoleArn": {
542548
"Fn::GetAtt": [
543549
"PipelineRoleD68726F7",
@@ -617,13 +623,7 @@
617623
],
618624
"Name": "Deploy"
619625
}
620-
],
621-
"ArtifactStore": {
622-
"Location": {
623-
"Ref": "PipelineBucketB967BD35"
624-
},
625-
"Type": "S3"
626-
}
626+
]
627627
},
628628
"DependsOn": [
629629
"PipelineRoleDefaultPolicyC7A05455",

packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeilne-elastic-beanstalk-deploy.js.snapshot/manifest.json

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"validateOnSynth": false,
1818
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}",
1919
"cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}",
20-
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/ae905796f14ca862d4e6f19382d8b2aae475b34b7c2395bd8fea7789d31809c6.json",
20+
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/c7f8ee5d9578c611b742c0b6a8bd6f94191be5d73984891ef4dbecc336be1be3.json",
2121
"requiresBootstrapStackVersion": 6,
2222
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version",
2323
"additionalDependencies": [
@@ -66,10 +66,7 @@
6666
"/aws-cdk-codepipeline-elastic-beanstalk-deploy/DeployApp/AwsCliLayer/Resource": [
6767
{
6868
"type": "aws:cdk:logicalId",
69-
"data": "DeployAppAwsCliLayerAEF99B2F",
70-
"trace": [
71-
"!!DESTRUCTIVE_CHANGES: WILL_REPLACE"
72-
]
69+
"data": "DeployAppAwsCliLayerAEF99B2F"
7370
}
7471
],
7572
"/aws-cdk-codepipeline-elastic-beanstalk-deploy/DeployApp/CustomResource/Default": [
@@ -123,10 +120,7 @@
123120
"/aws-cdk-codepipeline-elastic-beanstalk-deploy/beanstlk-env": [
124121
{
125122
"type": "aws:cdk:logicalId",
126-
"data": "beanstlkenv",
127-
"trace": [
128-
"!!DESTRUCTIVE_CHANGES: WILL_REPLACE"
129-
]
123+
"data": "beanstlkenv"
130124
}
131125
],
132126
"/aws-cdk-codepipeline-elastic-beanstalk-deploy/Pipeline/Role/Resource": [

0 commit comments

Comments
 (0)