Skip to content

Commit 9cb395c

Browse files
authored
fix(servicecatalog): only one ProductStack per Portfolio can use assets (#26885)
To move the assets into the target bucket, a `BucketDeployment` was created for every `ProductStack`. Instead, we will now share the same `BucketDeployment` for all `ProductStacks`. This moves the custom resource around in the construct tree (leading to replacement), but that is a safe operation. Nothing will be destroyed by this move. Closes #25189. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 803cfe3 commit 9cb395c

File tree

40 files changed

+2653
-498
lines changed

40 files changed

+2653
-498
lines changed

packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.nested-stack-in-product-stack.js.snapshot/aws-cdk-nested-stack-in-product-stack.assets.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "32.0.0",
2+
"version": "34.0.0",
33
"files": {
44
"d3833f63e813b3a96ea04c8c50ca98209330867f5f6ac358efca11f85a3476c2": {
55
"source": {
@@ -15,15 +15,15 @@
1515
}
1616
}
1717
},
18-
"292870ae2617f1c4d62ff18422e009afd534a342c17877fd1b931fb8d8a62abc": {
18+
"e2277687077a2abf9ae1af1cc9565e6715e2ebb62f79ec53aa75a1af9298f642": {
1919
"source": {
20-
"path": "asset.292870ae2617f1c4d62ff18422e009afd534a342c17877fd1b931fb8d8a62abc.zip",
20+
"path": "asset.e2277687077a2abf9ae1af1cc9565e6715e2ebb62f79ec53aa75a1af9298f642.zip",
2121
"packaging": "file"
2222
},
2323
"destinations": {
2424
"12345678-test-region": {
2525
"bucketName": "cdk-hnb659fds-assets-12345678-test-region",
26-
"objectKey": "292870ae2617f1c4d62ff18422e009afd534a342c17877fd1b931fb8d8a62abc.zip",
26+
"objectKey": "e2277687077a2abf9ae1af1cc9565e6715e2ebb62f79ec53aa75a1af9298f642.zip",
2727
"region": "test-region",
2828
"assumeRoleArn": "arn:${AWS::Partition}:iam::12345678:role/cdk-hnb659fds-file-publishing-role-12345678-test-region"
2929
}
@@ -85,15 +85,15 @@
8585
}
8686
}
8787
},
88-
"ba18bfbb3384019a2c62e3de7deb433f76c43587d1a01a4ead4d30e466252748": {
88+
"ac34a7f17e810848983abb8bddee14270b95a3d960fa3d8aa51bad606a23c8c0": {
8989
"source": {
9090
"path": "aws-cdk-nested-stack-in-product-stack.template.json",
9191
"packaging": "file"
9292
},
9393
"destinations": {
9494
"12345678-test-region": {
9595
"bucketName": "cdk-hnb659fds-assets-12345678-test-region",
96-
"objectKey": "ba18bfbb3384019a2c62e3de7deb433f76c43587d1a01a4ead4d30e466252748.json",
96+
"objectKey": "ac34a7f17e810848983abb8bddee14270b95a3d960fa3d8aa51bad606a23c8c0.json",
9797
"region": "test-region",
9898
"assumeRoleArn": "arn:${AWS::Partition}:iam::12345678:role/cdk-hnb659fds-file-publishing-role-12345678-test-region"
9999
}

packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.nested-stack-in-product-stack.js.snapshot/aws-cdk-nested-stack-in-product-stack.template.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,25 @@
66
"BucketName": "asset-bucket-12345678-test-region",
77
"Tags": [
88
{
9-
"Key": "aws-cdk:cr-owned:cea6ac02",
9+
"Key": "aws-cdk:cr-owned:2278d920",
1010
"Value": "true"
1111
}
1212
]
1313
},
1414
"UpdateReplacePolicy": "Retain",
1515
"DeletionPolicy": "Retain"
1616
},
17-
"AssetsBucketDeploymentAwsCliLayer9BCEE17F": {
17+
"AssetBucketProductAssetsDeploymentAwsCliLayerB57A37F8": {
1818
"Type": "AWS::Lambda::LayerVersion",
1919
"Properties": {
2020
"Content": {
2121
"S3Bucket": "cdk-hnb659fds-assets-12345678-test-region",
22-
"S3Key": "292870ae2617f1c4d62ff18422e009afd534a342c17877fd1b931fb8d8a62abc.zip"
22+
"S3Key": "e2277687077a2abf9ae1af1cc9565e6715e2ebb62f79ec53aa75a1af9298f642.zip"
2323
},
2424
"Description": "/opt/awscli/aws"
2525
}
2626
},
27-
"AssetsBucketDeploymentCustomResource283760D6": {
27+
"AssetBucketProductAssetsDeploymentCustomResource4B59DD1D": {
2828
"Type": "Custom::CDKBucketDeployment",
2929
"Properties": {
3030
"ServiceToken": {
@@ -51,6 +51,7 @@
5151
"DestinationBucketName": {
5252
"Ref": "AssetBucket1D025086"
5353
},
54+
"RetainOnDelete": true,
5455
"Extract": false,
5556
"Prune": false
5657
},
@@ -190,7 +191,7 @@
190191
"Handler": "index.handler",
191192
"Layers": [
192193
{
193-
"Ref": "AssetsBucketDeploymentAwsCliLayer9BCEE17F"
194+
"Ref": "AssetBucketProductAssetsDeploymentAwsCliLayerB57A37F8"
194195
}
195196
],
196197
"Role": {

packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.nested-stack-in-product-stack.js.snapshot/awscdknestedstackinproductstackintegDefaultTestDeployAssert7C8849C0.assets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "32.0.0",
2+
"version": "34.0.0",
33
"files": {
44
"21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": {
55
"source": {
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"version":"32.0.0"}
1+
{"version":"34.0.0"}

packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.nested-stack-in-product-stack.js.snapshot/integ.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "32.0.0",
2+
"version": "34.0.0",
33
"testCases": {
44
"aws-cdk-nested-stack-in-product-stack-integ/DefaultTest": {
55
"stacks": [

packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.nested-stack-in-product-stack.js.snapshot/manifest.json

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "32.0.0",
2+
"version": "34.0.0",
33
"artifacts": {
44
"aws-cdk-nested-stack-in-product-stack.assets": {
55
"type": "cdk:asset-manifest",
@@ -17,7 +17,7 @@
1717
"validateOnSynth": false,
1818
"assumeRoleArn": "arn:${AWS::Partition}:iam::12345678:role/cdk-hnb659fds-deploy-role-12345678-test-region",
1919
"cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::12345678:role/cdk-hnb659fds-cfn-exec-role-12345678-test-region",
20-
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-12345678-test-region/ba18bfbb3384019a2c62e3de7deb433f76c43587d1a01a4ead4d30e466252748.json",
20+
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-12345678-test-region/ac34a7f17e810848983abb8bddee14270b95a3d960fa3d8aa51bad606a23c8c0.json",
2121
"requiresBootstrapStackVersion": 6,
2222
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version",
2323
"additionalDependencies": [
@@ -39,16 +39,16 @@
3939
"data": "AssetBucket1D025086"
4040
}
4141
],
42-
"/aws-cdk-nested-stack-in-product-stack/AssetsBucketDeployment/AwsCliLayer/Resource": [
42+
"/aws-cdk-nested-stack-in-product-stack/AssetBucket/ProductAssetsDeployment/AwsCliLayer/Resource": [
4343
{
4444
"type": "aws:cdk:logicalId",
45-
"data": "AssetsBucketDeploymentAwsCliLayer9BCEE17F"
45+
"data": "AssetBucketProductAssetsDeploymentAwsCliLayerB57A37F8"
4646
}
4747
],
48-
"/aws-cdk-nested-stack-in-product-stack/AssetsBucketDeployment/CustomResource/Default": [
48+
"/aws-cdk-nested-stack-in-product-stack/AssetBucket/ProductAssetsDeployment/CustomResource/Default": [
4949
{
5050
"type": "aws:cdk:logicalId",
51-
"data": "AssetsBucketDeploymentCustomResource283760D6"
51+
"data": "AssetBucketProductAssetsDeploymentCustomResource4B59DD1D"
5252
}
5353
],
5454
"/aws-cdk-nested-stack-in-product-stack/Custom::CDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756C/ServiceRole/Resource": [
@@ -86,6 +86,24 @@
8686
"type": "aws:cdk:logicalId",
8787
"data": "CheckBootstrapVersion"
8888
}
89+
],
90+
"AssetsBucketDeploymentAwsCliLayer9BCEE17F": [
91+
{
92+
"type": "aws:cdk:logicalId",
93+
"data": "AssetsBucketDeploymentAwsCliLayer9BCEE17F",
94+
"trace": [
95+
"!!DESTRUCTIVE_CHANGES: WILL_DESTROY"
96+
]
97+
}
98+
],
99+
"AssetsBucketDeploymentCustomResource283760D6": [
100+
{
101+
"type": "aws:cdk:logicalId",
102+
"data": "AssetsBucketDeploymentCustomResource283760D6",
103+
"trace": [
104+
"!!DESTRUCTIVE_CHANGES: WILL_DESTROY"
105+
]
106+
}
89107
]
90108
},
91109
"displayName": "aws-cdk-nested-stack-in-product-stack"

0 commit comments

Comments
 (0)