Skip to content

Commit 8c38a3a

Browse files
garciparedessumupitchayan
authored andcommitted
fix(route53): delete old NS records on cross-account delegation renaming (#21249) (#27523)
…ing (#21249) Improve the `CustomResource` implementation that manages the `Route53`'s `NS` Records on the Account that host the parent `HostedZone` to consider renaming cases in which updates and deletes are both required. Closes #21249. This is related to #25285 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 12879fa commit 8c38a3a

File tree

22 files changed

+1208
-19
lines changed

22 files changed

+1208
-19
lines changed

packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.cross-account-zone-delegation.js.snapshot/asset.5f9b7d5ffbc596240b39dea7604f015f4d3a569311376cd1d6542ced29be4f87/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-route53/test/integ.cross-account-zone-delegation.js.snapshot/asset.8b3eb4893317dd327e9817a7e5472f97fd34125627ca21ac8cd6b0303a869b9a/index.js

-1
This file was deleted.

packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.cross-account-zone-delegation.js.snapshot/child-opt-in-stack.assets.json

+5-5
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-route53/test/integ.cross-account-zone-delegation.js.snapshot/child-opt-in-stack.template.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@
103103
"Properties": {
104104
"Code": {
105105
"S3Bucket": "cdk-hnb659fds-assets-234567890123-af-south-1",
106-
"S3Key": "8b3eb4893317dd327e9817a7e5472f97fd34125627ca21ac8cd6b0303a869b9a.zip"
106+
"S3Key": "5f9b7d5ffbc596240b39dea7604f015f4d3a569311376cd1d6542ced29be4f87.zip"
107107
},
108108
"Timeout": 900,
109109
"MemorySize": 128,

packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.cross-account-zone-delegation.js.snapshot/child-stack.assets.json

+5-5
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-route53/test/integ.cross-account-zone-delegation.js.snapshot/child-stack.template.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@
103103
"Properties": {
104104
"Code": {
105105
"S3Bucket": "cdk-hnb659fds-assets-234567890123-us-east-1",
106-
"S3Key": "8b3eb4893317dd327e9817a7e5472f97fd34125627ca21ac8cd6b0303a869b9a.zip"
106+
"S3Key": "5f9b7d5ffbc596240b39dea7604f015f4d3a569311376cd1d6542ced29be4f87.zip"
107107
},
108108
"Timeout": 900,
109109
"MemorySize": 128,

packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.cross-account-zone-delegation.js.snapshot/manifest.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-route53/test/integ.rename-cross-account-zone-delegation.js.snapshot/Route53RenameCrossAccountIntegDefaultTestDeployAssert2D0BD417.assets.json

+19
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-route53/test/integ.rename-cross-account-zone-delegation.js.snapshot/Route53RenameCrossAccountIntegDefaultTestDeployAssert2D0BD417.template.json

+36
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-route53/test/integ.rename-cross-account-zone-delegation.js.snapshot/asset.5f9b7d5ffbc596240b39dea7604f015f4d3a569311376cd1d6542ced29be4f87/__entrypoint__.js

+147
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-route53/test/integ.rename-cross-account-zone-delegation.js.snapshot/asset.5f9b7d5ffbc596240b39dea7604f015f4d3a569311376cd1d6542ced29be4f87/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-route53/test/integ.rename-cross-account-zone-delegation.js.snapshot/cdk.out

+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-route53/test/integ.rename-cross-account-zone-delegation.js.snapshot/child-stack.assets.json

+34
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
{
2+
"Resources": {
3+
"NewSubZone1DFF192F": {
4+
"Type": "AWS::Route53::HostedZone",
5+
"Properties": {
6+
"Name": "new.uniqueexample.com."
7+
}
8+
},
9+
"delegatecrossaccountzonedelegationhandlerrolePolicychildstackdelegatecrossaccountzonedelegationhandlerroleCB13E48E86169197": {
10+
"Type": "AWS::IAM::Policy",
11+
"Properties": {
12+
"PolicyDocument": {
13+
"Statement": [
14+
{
15+
"Action": "sts:AssumeRole",
16+
"Effect": "Allow",
17+
"Resource": "arn:aws:iam::12345678:role/MyUniqueDelegationRole"
18+
}
19+
],
20+
"Version": "2012-10-17"
21+
},
22+
"PolicyName": "PolicychildstackdelegatecrossaccountzonedelegationhandlerroleCB13E48E",
23+
"Roles": [
24+
{
25+
"Fn::Select": [
26+
1,
27+
{
28+
"Fn::Split": [
29+
"/",
30+
{
31+
"Fn::Select": [
32+
5,
33+
{
34+
"Fn::Split": [
35+
":",
36+
{
37+
"Fn::GetAtt": [
38+
"CustomCrossAccountZoneDelegationCustomResourceProviderRoleED64687B",
39+
"Arn"
40+
]
41+
}
42+
]
43+
}
44+
]
45+
}
46+
]
47+
}
48+
]
49+
}
50+
]
51+
}
52+
},
53+
"delegateCrossAccountZoneDelegationCustomResource23BD590B": {
54+
"Type": "Custom::CrossAccountZoneDelegation",
55+
"Properties": {
56+
"ServiceToken": {
57+
"Fn::GetAtt": [
58+
"CustomCrossAccountZoneDelegationCustomResourceProviderHandler44A84265",
59+
"Arn"
60+
]
61+
},
62+
"AssumeRoleArn": "arn:aws:iam::12345678:role/MyUniqueDelegationRole",
63+
"ParentZoneName": "uniqueexample.com",
64+
"DelegatedZoneName": "new.uniqueexample.com",
65+
"DelegatedZoneNameServers": {
66+
"Fn::GetAtt": [
67+
"NewSubZone1DFF192F",
68+
"NameServers"
69+
]
70+
},
71+
"TTL": 172800
72+
},
73+
"DependsOn": [
74+
"delegatecrossaccountzonedelegationhandlerrolePolicychildstackdelegatecrossaccountzonedelegationhandlerroleCB13E48E86169197"
75+
],
76+
"UpdateReplacePolicy": "Delete",
77+
"DeletionPolicy": "Delete"
78+
},
79+
"CustomCrossAccountZoneDelegationCustomResourceProviderRoleED64687B": {
80+
"Type": "AWS::IAM::Role",
81+
"Properties": {
82+
"AssumeRolePolicyDocument": {
83+
"Version": "2012-10-17",
84+
"Statement": [
85+
{
86+
"Action": "sts:AssumeRole",
87+
"Effect": "Allow",
88+
"Principal": {
89+
"Service": "lambda.amazonaws.com"
90+
}
91+
}
92+
]
93+
},
94+
"ManagedPolicyArns": [
95+
{
96+
"Fn::Sub": "arn:${AWS::Partition}:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
97+
}
98+
]
99+
}
100+
},
101+
"CustomCrossAccountZoneDelegationCustomResourceProviderHandler44A84265": {
102+
"Type": "AWS::Lambda::Function",
103+
"Properties": {
104+
"Code": {
105+
"S3Bucket": "cdk-hnb659fds-assets-234567890123-us-east-1",
106+
"S3Key": "5f9b7d5ffbc596240b39dea7604f015f4d3a569311376cd1d6542ced29be4f87.zip"
107+
},
108+
"Timeout": 900,
109+
"MemorySize": 128,
110+
"Handler": "__entrypoint__.handler",
111+
"Role": {
112+
"Fn::GetAtt": [
113+
"CustomCrossAccountZoneDelegationCustomResourceProviderRoleED64687B",
114+
"Arn"
115+
]
116+
},
117+
"Runtime": "nodejs18.x"
118+
},
119+
"DependsOn": [
120+
"CustomCrossAccountZoneDelegationCustomResourceProviderRoleED64687B"
121+
]
122+
}
123+
},
124+
"Parameters": {
125+
"BootstrapVersion": {
126+
"Type": "AWS::SSM::Parameter::Value<String>",
127+
"Default": "/cdk-bootstrap/hnb659fds/version",
128+
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
129+
}
130+
},
131+
"Rules": {
132+
"CheckBootstrapVersion": {
133+
"Assertions": [
134+
{
135+
"Assert": {
136+
"Fn::Not": [
137+
{
138+
"Fn::Contains": [
139+
[
140+
"1",
141+
"2",
142+
"3",
143+
"4",
144+
"5"
145+
],
146+
{
147+
"Ref": "BootstrapVersion"
148+
}
149+
]
150+
}
151+
]
152+
},
153+
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
154+
}
155+
]
156+
}
157+
}
158+
}

packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.rename-cross-account-zone-delegation.js.snapshot/integ.json

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

0 commit comments

Comments
 (0)