Skip to content

Commit ece7eb6

Browse files
authored
fix(globalaccelerator): changing installLatestAwsSdk breaks Security Group reference (#29620)
### Issue # (if applicable) Closes #23796 ### Reason for this change In #23591 `installLatestAwsSdk`. This results in a resource update for custom resources. The custom resource that fetches the security groups does not have an onUpdate handler (https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk-lib/aws-globalaccelerator/lib/_accelerator-security-group.ts#L32). When the empty object is returned, this results in an update failure in CloudFormation because the specific property isn't available and so it will fail with error below: ``` CustomResource attribute error: Vendor response doesn't contain SecurityGroups.0.GroupId key in object ``` When the update occurs, the response object does not have a `SecurityGroups.0.GroupId` field, resulting in failures when `SecurityGroups` is referenced. ### Description of changes Update the onCreate to onUpdate for custom resources to mitigate the CloudFormation update failure. Documentations: https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.custom_resources.AwsCustomResource.html#oncreate. Similar fix for Cognito: #23798 ### Description of how you validated changes The integration test is updated with the latest assets. ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 97e9ea0 commit ece7eb6

File tree

18 files changed

+209
-253
lines changed

18 files changed

+209
-253
lines changed

packages/@aws-cdk-testing/framework-integ/test/aws-globalaccelerator-endpoints/test/integ.globalaccelerator.js.snapshot/integ-globalaccelerator.assets.json

+2-2
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-globalaccelerator-endpoints/test/integ.globalaccelerator.js.snapshot/integ-globalaccelerator.template.json

+12
Original file line numberDiff line numberDiff line change
@@ -746,6 +746,18 @@
746746
]
747747
]
748748
},
749+
"Update": {
750+
"Fn::Join": [
751+
"",
752+
[
753+
"{\"service\":\"EC2\",\"action\":\"describeSecurityGroups\",\"parameters\":{\"Filters\":[{\"Name\":\"group-name\",\"Values\":[\"GlobalAccelerator\"]},{\"Name\":\"vpc-id\",\"Values\":[\"",
754+
{
755+
"Ref": "VPCB9E5F0B4"
756+
},
757+
"\"]}]},\"physicalResourceId\":{\"responsePath\":\"SecurityGroups.0.GroupId\"}}"
758+
]
759+
]
760+
},
749761
"InstallLatestAwsSdk": false
750762
},
751763
"DependsOn": [

packages/@aws-cdk-testing/framework-integ/test/aws-globalaccelerator-endpoints/test/integ.globalaccelerator.js.snapshot/manifest.json

+1-1
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-globalaccelerator-endpoints/test/integ.globalaccelerator.ts

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ class GaStack extends Stack {
4646
});
4747

4848
alb.connections.allowFrom(group.connectionsPeer('Peer', vpc), ec2.Port.tcp(443));
49+
4950
}
5051
}
5152

packages/@aws-cdk-testing/framework-integ/test/aws-globalaccelerator/test/integ.globalaccelerator-endpoints.js.snapshot/GlobalAcceleratorEndpointsDefaultTestDeployAssert3F2DB71B.assets.json

+1-1
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-globalaccelerator/test/integ.globalaccelerator-endpoints.js.snapshot/asset.18d379b052acd60e0d086d5b19d9bef956ebc0bd018c5570960125aab0c7f837/__entrypoint__.js

-147
This file was deleted.

packages/@aws-cdk-testing/framework-integ/test/aws-globalaccelerator/test/integ.globalaccelerator-endpoints.js.snapshot/asset.18d379b052acd60e0d086d5b19d9bef956ebc0bd018c5570960125aab0c7f837/index.js

-81
This file was deleted.

packages/@aws-cdk-testing/framework-integ/test/aws-globalaccelerator/test/integ.globalaccelerator-endpoints.js.snapshot/asset.482f9f5ffd706706c8ef3652699d6c945568786593d3571e4331ecb1f966c932/index.js

+1
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-globalaccelerator/test/integ.globalaccelerator-endpoints.js.snapshot/asset.e5178afc49b7c6a85127a67856ce958e4f0879ce6aad5e974cac2a088bf939db/index.js

-1
This file was deleted.

packages/@aws-cdk-testing/framework-integ/test/aws-globalaccelerator/test/integ.globalaccelerator-endpoints.js.snapshot/asset.e978ad4ad0dca7e1c6be5f49cbbd1c5a150ee050c24052fedfe5a42f835d55da/__entrypoint__.js

+156
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-globalaccelerator/test/integ.globalaccelerator-endpoints.js.snapshot/asset.e978ad4ad0dca7e1c6be5f49cbbd1c5a150ee050c24052fedfe5a42f835d55da/index.js

+1
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-globalaccelerator/test/integ.globalaccelerator-endpoints.js.snapshot/cdk.out

+1-1
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-globalaccelerator/test/integ.globalaccelerator-endpoints.js.snapshot/global-accelerator-endpoints2.assets.json

+9-9
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-globalaccelerator/test/integ.globalaccelerator-endpoints.js.snapshot/global-accelerator-endpoints2.template.json

+14-2
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@
489489
"S3Bucket": {
490490
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
491491
},
492-
"S3Key": "18d379b052acd60e0d086d5b19d9bef956ebc0bd018c5570960125aab0c7f837.zip"
492+
"S3Key": "e978ad4ad0dca7e1c6be5f49cbbd1c5a150ee050c24052fedfe5a42f835d55da.zip"
493493
},
494494
"Timeout": 900,
495495
"MemorySize": 128,
@@ -579,6 +579,18 @@
579579
]
580580
]
581581
},
582+
"Update": {
583+
"Fn::Join": [
584+
"",
585+
[
586+
"{\"service\":\"EC2\",\"action\":\"describeSecurityGroups\",\"parameters\":{\"Filters\":[{\"Name\":\"group-name\",\"Values\":[\"GlobalAccelerator\"]},{\"Name\":\"vpc-id\",\"Values\":[\"",
587+
{
588+
"Ref": "Vpc8378EB38"
589+
},
590+
"\"]}]},\"physicalResourceId\":{\"responsePath\":\"SecurityGroups.0.GroupId\"}}"
591+
]
592+
]
593+
},
582594
"InstallLatestAwsSdk": false
583595
},
584596
"DependsOn": [
@@ -699,7 +711,7 @@
699711
"S3Bucket": {
700712
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
701713
},
702-
"S3Key": "e5178afc49b7c6a85127a67856ce958e4f0879ce6aad5e974cac2a088bf939db.zip"
714+
"S3Key": "482f9f5ffd706706c8ef3652699d6c945568786593d3571e4331ecb1f966c932.zip"
703715
},
704716
"Handler": "index.handler",
705717
"Role": {

packages/@aws-cdk-testing/framework-integ/test/aws-globalaccelerator/test/integ.globalaccelerator-endpoints.js.snapshot/integ.json

+1-1
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-globalaccelerator/test/integ.globalaccelerator-endpoints.js.snapshot/manifest.json

+4-2
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-globalaccelerator/test/integ.globalaccelerator-endpoints.js.snapshot/tree.json

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)