Skip to content

Commit

Permalink
fix(servicecatalog): only one ProductStack per Portfolio can use asse…
Browse files Browse the repository at this point in the history
…ts (#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*
  • Loading branch information
rix0rrr committed Aug 25, 2023
1 parent 803cfe3 commit 9cb395c
Show file tree
Hide file tree
Showing 40 changed files with 2,653 additions and 498 deletions.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "32.0.0",
"version": "34.0.0",
"files": {
"d3833f63e813b3a96ea04c8c50ca98209330867f5f6ac358efca11f85a3476c2": {
"source": {
Expand All @@ -15,15 +15,15 @@
}
}
},
"292870ae2617f1c4d62ff18422e009afd534a342c17877fd1b931fb8d8a62abc": {
"e2277687077a2abf9ae1af1cc9565e6715e2ebb62f79ec53aa75a1af9298f642": {
"source": {
"path": "asset.292870ae2617f1c4d62ff18422e009afd534a342c17877fd1b931fb8d8a62abc.zip",
"path": "asset.e2277687077a2abf9ae1af1cc9565e6715e2ebb62f79ec53aa75a1af9298f642.zip",
"packaging": "file"
},
"destinations": {
"12345678-test-region": {
"bucketName": "cdk-hnb659fds-assets-12345678-test-region",
"objectKey": "292870ae2617f1c4d62ff18422e009afd534a342c17877fd1b931fb8d8a62abc.zip",
"objectKey": "e2277687077a2abf9ae1af1cc9565e6715e2ebb62f79ec53aa75a1af9298f642.zip",
"region": "test-region",
"assumeRoleArn": "arn:${AWS::Partition}:iam::12345678:role/cdk-hnb659fds-file-publishing-role-12345678-test-region"
}
Expand Down Expand Up @@ -85,15 +85,15 @@
}
}
},
"ba18bfbb3384019a2c62e3de7deb433f76c43587d1a01a4ead4d30e466252748": {
"ac34a7f17e810848983abb8bddee14270b95a3d960fa3d8aa51bad606a23c8c0": {
"source": {
"path": "aws-cdk-nested-stack-in-product-stack.template.json",
"packaging": "file"
},
"destinations": {
"12345678-test-region": {
"bucketName": "cdk-hnb659fds-assets-12345678-test-region",
"objectKey": "ba18bfbb3384019a2c62e3de7deb433f76c43587d1a01a4ead4d30e466252748.json",
"objectKey": "ac34a7f17e810848983abb8bddee14270b95a3d960fa3d8aa51bad606a23c8c0.json",
"region": "test-region",
"assumeRoleArn": "arn:${AWS::Partition}:iam::12345678:role/cdk-hnb659fds-file-publishing-role-12345678-test-region"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,25 @@
"BucketName": "asset-bucket-12345678-test-region",
"Tags": [
{
"Key": "aws-cdk:cr-owned:cea6ac02",
"Key": "aws-cdk:cr-owned:2278d920",
"Value": "true"
}
]
},
"UpdateReplacePolicy": "Retain",
"DeletionPolicy": "Retain"
},
"AssetsBucketDeploymentAwsCliLayer9BCEE17F": {
"AssetBucketProductAssetsDeploymentAwsCliLayerB57A37F8": {
"Type": "AWS::Lambda::LayerVersion",
"Properties": {
"Content": {
"S3Bucket": "cdk-hnb659fds-assets-12345678-test-region",
"S3Key": "292870ae2617f1c4d62ff18422e009afd534a342c17877fd1b931fb8d8a62abc.zip"
"S3Key": "e2277687077a2abf9ae1af1cc9565e6715e2ebb62f79ec53aa75a1af9298f642.zip"
},
"Description": "/opt/awscli/aws"
}
},
"AssetsBucketDeploymentCustomResource283760D6": {
"AssetBucketProductAssetsDeploymentCustomResource4B59DD1D": {
"Type": "Custom::CDKBucketDeployment",
"Properties": {
"ServiceToken": {
Expand All @@ -51,6 +51,7 @@
"DestinationBucketName": {
"Ref": "AssetBucket1D025086"
},
"RetainOnDelete": true,
"Extract": false,
"Prune": false
},
Expand Down Expand Up @@ -190,7 +191,7 @@
"Handler": "index.handler",
"Layers": [
{
"Ref": "AssetsBucketDeploymentAwsCliLayer9BCEE17F"
"Ref": "AssetBucketProductAssetsDeploymentAwsCliLayerB57A37F8"
}
],
"Role": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "32.0.0",
"version": "34.0.0",
"files": {
"21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": {
"source": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version":"32.0.0"}
{"version":"34.0.0"}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "32.0.0",
"version": "34.0.0",
"testCases": {
"aws-cdk-nested-stack-in-product-stack-integ/DefaultTest": {
"stacks": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "32.0.0",
"version": "34.0.0",
"artifacts": {
"aws-cdk-nested-stack-in-product-stack.assets": {
"type": "cdk:asset-manifest",
Expand All @@ -17,7 +17,7 @@
"validateOnSynth": false,
"assumeRoleArn": "arn:${AWS::Partition}:iam::12345678:role/cdk-hnb659fds-deploy-role-12345678-test-region",
"cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::12345678:role/cdk-hnb659fds-cfn-exec-role-12345678-test-region",
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-12345678-test-region/ba18bfbb3384019a2c62e3de7deb433f76c43587d1a01a4ead4d30e466252748.json",
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-12345678-test-region/ac34a7f17e810848983abb8bddee14270b95a3d960fa3d8aa51bad606a23c8c0.json",
"requiresBootstrapStackVersion": 6,
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version",
"additionalDependencies": [
Expand All @@ -39,16 +39,16 @@
"data": "AssetBucket1D025086"
}
],
"/aws-cdk-nested-stack-in-product-stack/AssetsBucketDeployment/AwsCliLayer/Resource": [
"/aws-cdk-nested-stack-in-product-stack/AssetBucket/ProductAssetsDeployment/AwsCliLayer/Resource": [
{
"type": "aws:cdk:logicalId",
"data": "AssetsBucketDeploymentAwsCliLayer9BCEE17F"
"data": "AssetBucketProductAssetsDeploymentAwsCliLayerB57A37F8"
}
],
"/aws-cdk-nested-stack-in-product-stack/AssetsBucketDeployment/CustomResource/Default": [
"/aws-cdk-nested-stack-in-product-stack/AssetBucket/ProductAssetsDeployment/CustomResource/Default": [
{
"type": "aws:cdk:logicalId",
"data": "AssetsBucketDeploymentCustomResource283760D6"
"data": "AssetBucketProductAssetsDeploymentCustomResource4B59DD1D"
}
],
"/aws-cdk-nested-stack-in-product-stack/Custom::CDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756C/ServiceRole/Resource": [
Expand Down Expand Up @@ -86,6 +86,24 @@
"type": "aws:cdk:logicalId",
"data": "CheckBootstrapVersion"
}
],
"AssetsBucketDeploymentAwsCliLayer9BCEE17F": [
{
"type": "aws:cdk:logicalId",
"data": "AssetsBucketDeploymentAwsCliLayer9BCEE17F",
"trace": [
"!!DESTRUCTIVE_CHANGES: WILL_DESTROY"
]
}
],
"AssetsBucketDeploymentCustomResource283760D6": [
{
"type": "aws:cdk:logicalId",
"data": "AssetsBucketDeploymentCustomResource283760D6",
"trace": [
"!!DESTRUCTIVE_CHANGES: WILL_DESTROY"
]
}
]
},
"displayName": "aws-cdk-nested-stack-in-product-stack"
Expand Down
Loading

0 comments on commit 9cb395c

Please sign in to comment.