Currently deployments of stacks fail if they contain a CrossAccountZoneDelegationRecord where the parent hosted zone name has a trailing dot (supplied in construct property parentHostedZoneName).
Expected Behavior
Deployment is expected to work transparently, regardless of whether or not there is a trailing dot. This is expected since:
Route53 already treats these two names as synonymous - the trailing dot is stripped under Hosted zone name in the AWS console, but present elsewhere, e.g. aws route53 list-hosted-zones | jq '.HostedZones[].Name'. The ListHostedZonesByName action also appears to handle both.
Zone names with the trailing dot is arguably the more correct representation, since this is what appears in the generated AWS::Route53::HostedZone CFN by default when using PublicHostedZone/PrivateHostedZone constructs, and is used by the Route53 API.
Current Behavior
CloudFormation deployment of the parent stack fails - in Events:
Status: CREATE_FAILED
Status reason: Received response status [FAILED] from custom resource. Message returned: Error: Expected one hosted zone to match the given name but found 0 at A (/var/task/index.js:1:1613) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async s (/var/task/index.js:1:1272) at async Runtime.handler (/var/task/__entrypoint__.js:1:932)
The preceding ListHostedZonesByName call likely does not need to be changed (both formats should yield the same response), however this should be confirmed.
Describe the bug
Currently deployments of stacks fail if they contain a
CrossAccountZoneDelegationRecord
where the parent hosted zone name has a trailing dot (supplied in construct propertyparentHostedZoneName
).Expected Behavior
Deployment is expected to work transparently, regardless of whether or not there is a trailing dot. This is expected since:
aws route53 list-hosted-zones | jq '.HostedZones[].Name'
. TheListHostedZonesByName
action also appears to handle both.AWS::Route53::HostedZone
CFN by default when using PublicHostedZone/PrivateHostedZone constructs, and is used by the Route53 API.Current Behavior
CloudFormation deployment of the parent stack fails - in Events:
Status:
CREATE_FAILED
Status reason:
Received response status [FAILED] from custom resource. Message returned: Error: Expected one hosted zone to match the given name but found 0 at A (/var/task/index.js:1:1613) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async s (/var/task/index.js:1:1272) at async Runtime.handler (/var/task/__entrypoint__.js:1:932)
Reproduction Steps
parentHostedZoneName
to contain a trailing dot.Possible Solution
Change filter in custom resource handler to not append the trailing dot automatically: https://github.com/aws/aws-cdk/blob/3656a4c06539e68a2eda3d3b98f5d92e956dc37d/packages/%40aws-cdk/custom-resource-handlers/lib/aws-route53/cross-account-zone-delegation-handler/index.ts#L78-L83
The preceding
ListHostedZonesByName
call likely does not need to be changed (both formats should yield the same response), however this should be confirmed.Additional Information/Context
No response
CDK CLI Version
2
Framework Version
No response
Node.js Version
18.18.2
OS
Amazon Linux 2
Language
TypeScript
Language Version
No response
Other information
No response