Skip to content

Commit 95280a0

Browse files
authoredJun 21, 2024
revert: route53 CrossAccountZoneDelegationRecord fails at deployment time with imported delegatedZone (#30440)" (#30606)
This reverts commit a3d9b10. ### Issue # (if applicable) Closes #30600. ### Reason for this change Reverting #30440 so that `cdk synth` succeed when using imported `delegatedZone` ### Description of changes Removed the `throw new Error()` ### Description of how you validated changes ### 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 8b495f9 commit 95280a0

File tree

3 files changed

+1
-26
lines changed

3 files changed

+1
-26
lines changed
 

‎packages/aws-cdk-lib/aws-route53/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ const delegationRole = iam.Role.fromRoleArn(this, 'DelegationRole', delegationRo
313313

314314
// create the record
315315
new route53.CrossAccountZoneDelegationRecord(this, 'delegate', {
316-
delegatedZone: subZone, // Note that an imported HostedZone is not supported as Name Servers info will not be available
316+
delegatedZone: subZone,
317317
parentHostedZoneName: 'someexample.com', // or you can use parentHostedZoneId
318318
delegationRole,
319319
});

‎packages/aws-cdk-lib/aws-route53/lib/record-set.ts

-4
Original file line numberDiff line numberDiff line change
@@ -929,10 +929,6 @@ export class CrossAccountZoneDelegationRecord extends Construct {
929929
throw Error('Only one of parentHostedZoneName and parentHostedZoneId is supported');
930930
}
931931

932-
if (!props.delegatedZone.hostedZoneNameServers) {
933-
throw Error(`Not able to retrieve Name Servers for ${props.delegatedZone.zoneName} due to it being imported.`);
934-
}
935-
936932
const provider = CrossAccountZoneDelegationProvider.getOrCreateProvider(this, CROSS_ACCOUNT_ZONE_DELEGATION_RESOURCE_TYPE);
937933

938934
const role = iam.Role.fromRoleArn(this, 'cross-account-zone-delegation-handler-role', provider.roleArn);

‎packages/aws-cdk-lib/aws-route53/test/record-set.test.ts

-21
Original file line numberDiff line numberDiff line change
@@ -893,27 +893,6 @@ describe('record set', () => {
893893
});
894894
});
895895

896-
test('CrossAccountZoneDelegationRecord should throw if delegatedZone is imported', () => {
897-
// GIVEN
898-
const stack = new Stack();
899-
const parentZone = new route53.PublicHostedZone(stack, 'ParentHostedZone', {
900-
zoneName: 'myzone.com',
901-
});
902-
903-
// WHEN
904-
const childZone = route53.PublicHostedZone.fromPublicHostedZoneAttributes(stack, 'ChildHostedZone', {
905-
hostedZoneId: 'fake-id',
906-
zoneName: 'fake-name',
907-
});
908-
909-
//THEN
910-
expect(() => new route53.CrossAccountZoneDelegationRecord(stack, 'Delegation', {
911-
delegatedZone: childZone,
912-
parentHostedZoneId: parentZone.hostedZoneId,
913-
delegationRole: parentZone.crossAccountZoneDelegationRole!,
914-
})).toThrow(/Not able to retrieve Name Servers for fake-name due to it being imported./);
915-
});
916-
917896
testDeprecated('Cross account zone delegation record with parentHostedZoneName', () => {
918897
// GIVEN
919898
const stack = new Stack();

0 commit comments

Comments
 (0)