Skip to content

Commit 1e67f9d

Browse files
authored
fix(ec2): restrictDefaultSecurityGroup fails when default rules are not present (#27039)
When using [restrictDefaultSecurityGroup](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2-readme.html#restricting-access-to-the-vpc-default-security-group) to remove default security group rules, an error is thrown and the deploy rolls back if the default rules are not found. This error usually happens when developers previously removed default rules manually or by other means, and then want to switch to using `restrictDefaultSecurityGroup`. They have to re-add default rules and deploy again to cope with the error. This PR fixes the custom resource to ignore the error when default rules are not found. Closes #26390 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent a8f0a71 commit 1e67f9d

File tree

12 files changed

+32362
-100
lines changed

12 files changed

+32362
-100
lines changed

packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.table-v2-replica.js.snapshot/asset.d4087f9b90522f437499693de83d9bb1d3d93a99d4d34dad4625e71132244692.bundle/index.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
"use strict";
21
var __create = Object.create;
32
var __defProp = Object.defineProperty;
43
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -32092,7 +32091,6 @@ var CustomResourceHandler = class {
3209232091
constructor(event, context) {
3209332092
this.event = event;
3209432093
this.context = context;
32095-
this.timedOut = false;
3209632094
this.timeout = setTimeout(async () => {
3209732095
await this.respond({
3209832096
status: "FAILED",
@@ -32104,6 +32102,9 @@ var CustomResourceHandler = class {
3210432102
this.event = event;
3210532103
this.physicalResourceId = extractPhysicalResourceId(event);
3210632104
}
32105+
physicalResourceId;
32106+
timeout;
32107+
timedOut = false;
3210732108
/**
3210832109
* Handles executing the custom resource event. If `stateMachineArn` is present
3210932110
* in the props then trigger the waiter statemachine
@@ -32237,6 +32238,7 @@ var AssertionHandler = class extends CustomResourceHandler {
3223732238
}
3223832239
};
3223932240
var MatchCreator = class {
32241+
parsedObj;
3224032242
constructor(obj) {
3224132243
this.parsedObj = {
3224232244
matcher: obj

packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.oidc.js.snapshot/IntegAlbOidc.assets.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{
22
"version": "34.0.0",
33
"files": {
4-
"18d379b052acd60e0d086d5b19d9bef956ebc0bd018c5570960125aab0c7f837": {
4+
"1be0bac6581864b510bdbf0a114f1d3429244758da7657cc365f73d371fe70ed": {
55
"source": {
6-
"path": "asset.18d379b052acd60e0d086d5b19d9bef956ebc0bd018c5570960125aab0c7f837",
6+
"path": "asset.1be0bac6581864b510bdbf0a114f1d3429244758da7657cc365f73d371fe70ed",
77
"packaging": "zip"
88
},
99
"destinations": {
1010
"current_account-current_region": {
1111
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
12-
"objectKey": "18d379b052acd60e0d086d5b19d9bef956ebc0bd018c5570960125aab0c7f837.zip",
12+
"objectKey": "1be0bac6581864b510bdbf0a114f1d3429244758da7657cc365f73d371fe70ed.zip",
1313
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
1414
}
1515
}
@@ -40,15 +40,15 @@
4040
}
4141
}
4242
},
43-
"f1fb2cedf775ba9061a3a81a24cd729ed3530f03bf3d9b426f8cbd6efe9c945a": {
43+
"fb9900acb2994b9169f569dd68a0d17965c3044008b791311d96be6cfe55bbc5": {
4444
"source": {
4545
"path": "IntegAlbOidc.template.json",
4646
"packaging": "file"
4747
},
4848
"destinations": {
4949
"current_account-current_region": {
5050
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
51-
"objectKey": "f1fb2cedf775ba9061a3a81a24cd729ed3530f03bf3d9b426f8cbd6efe9c945a.json",
51+
"objectKey": "fb9900acb2994b9169f569dd68a0d17965c3044008b791311d96be6cfe55bbc5.json",
5252
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
5353
}
5454
}

packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.oidc.js.snapshot/IntegAlbOidc.template.json

+1-1
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": "1be0bac6581864b510bdbf0a114f1d3429244758da7657cc365f73d371fe70ed.zip"
493493
},
494494
"Timeout": 900,
495495
"MemorySize": 128,

packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.oidc.js.snapshot/IntegTestAlbOidcDefaultTestDeployAssert2476ECB6.assets.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
{
22
"version": "34.0.0",
33
"files": {
4-
"144a0fcf5cb08c347ee9f860c889f4c2921b613fe68e84aae74fbbd448fbbe08": {
4+
"63ae5d5f48d3638501e722718b99b5f2fddb9ab73a15d7cb607215a500df19e1": {
55
"source": {
6-
"path": "asset.144a0fcf5cb08c347ee9f860c889f4c2921b613fe68e84aae74fbbd448fbbe08.bundle",
6+
"path": "asset.63ae5d5f48d3638501e722718b99b5f2fddb9ab73a15d7cb607215a500df19e1.bundle",
77
"packaging": "zip"
88
},
99
"destinations": {
1010
"current_account-current_region": {
1111
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
12-
"objectKey": "144a0fcf5cb08c347ee9f860c889f4c2921b613fe68e84aae74fbbd448fbbe08.zip",
12+
"objectKey": "63ae5d5f48d3638501e722718b99b5f2fddb9ab73a15d7cb607215a500df19e1.zip",
1313
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
1414
}
1515
}
1616
},
17-
"65e1fbcc8f1bca9cfd6e6c3a1f3f1eff2625dfb8a98c1e2abf896a1cdabee8e3": {
17+
"1fcb5fbc3068d3437742a4ff4539694cf17f0ffd96791be266458be45866ae78": {
1818
"source": {
1919
"path": "IntegTestAlbOidcDefaultTestDeployAssert2476ECB6.template.json",
2020
"packaging": "file"
2121
},
2222
"destinations": {
2323
"current_account-current_region": {
2424
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
25-
"objectKey": "65e1fbcc8f1bca9cfd6e6c3a1f3f1eff2625dfb8a98c1e2abf896a1cdabee8e3.json",
25+
"objectKey": "1fcb5fbc3068d3437742a4ff4539694cf17f0ffd96791be266458be45866ae78.json",
2626
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
2727
}
2828
}

packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.oidc.js.snapshot/IntegTestAlbOidcDefaultTestDeployAssert2476ECB6.template.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
}
2828
},
2929
"flattenResponse": "false",
30-
"salt": "1694766833913"
30+
"salt": "1695146725968"
3131
},
3232
"UpdateReplacePolicy": "Delete",
3333
"DeletionPolicy": "Delete"
@@ -127,7 +127,7 @@
127127
"S3Bucket": {
128128
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
129129
},
130-
"S3Key": "144a0fcf5cb08c347ee9f860c889f4c2921b613fe68e84aae74fbbd448fbbe08.zip"
130+
"S3Key": "63ae5d5f48d3638501e722718b99b5f2fddb9ab73a15d7cb607215a500df19e1.zip"
131131
},
132132
"Timeout": 120,
133133
"Handler": "index.handler",

packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.oidc.js.snapshot/asset.18d379b052acd60e0d086d5b19d9bef956ebc0bd018c5570960125aab0c7f837/index.js

-81
This file was deleted.

0 commit comments

Comments
 (0)