[Route53] HostedZone.hostedZoneNameServers property does not synthesize correctly
See original GitHub issueThe synthesized template contains a CDK Token rather than a cloudformation Fn::GetAtt statement when referencing the hostedZoneNameServers property of a HostedZone construct.
Reproduction Steps
const zone = new HostedZone(this, 'HostedZone', {
zoneName: 'example.com',
})
const nameServer1 = zone.hostedZoneNameServers ? zone.hostedZoneNameServers[0] : 'UNDEFINED'
new CfnOutput(this, 'ZoneId', { value: zone.hostedZoneId })
new CfnOutput(this, 'NameServer1', { value: nameServer1 })
What did you expect to happen?
NameServer1
Cfn output in the template should consist of a Fn::GetAtt expression, not a CDK token.
What actually happened?
Synthesized template contains:
"Outputs": {
"HostedZoneId": {
"Value": {
"Ref": "HostedZoneDB99F866"
}
},
"NameServer1": {
"Value": "#{Token[TOKEN.93]}"
}
},
NOTE: Also expect this to work if zone.hostedZoneNameServers
is used where an array is expected.
Environment
- CLI Version : 1.70.0
- Framework Version: 1.70.0
- Node.js Version: v14.2.0
- OS :MacOS Catalina 10.15.7
- Language (Version): typescript 4.0.3
Other
A public HostedZone will always have nameservers, a private zone will not. Perhaps change the semantics so that the zone.hostedZoneNameServers
property is guaranteed to be defined in a public zone. This might make it easier to synthesize correctly?
This is 🐛 Bug Report
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
class HostedZone (construct) · AWS CDK
Import a Route 53 hosted zone defined either outside the CDK, or in a different CDK stack. Use when hosted zone ID is...
Read more >AWS CDK -- How do I retrieve my NS Records from my newly ...
I did try the hostedZoneNameServers property. However, it doesn't seem to return anything. const zone = route53.HostedZone.fromLookup(this, ' ...
Read more >How To Use AWS Route53 Wildcard Subdomains With CDK
The Hosted Zone is easiest to set up if you have a domain that is managed by Route 53 and that you don't...
Read more >awsroute53 - Go Packages
Construction properties for a ARecord. Example: import apigw "github.com/aws/aws-cdk-go/awscdk" var zone hostedZone var restApi lambdaRestApi route53.
Read more >AWS::Route53::HostedZone - Amazon CloudFormation
You can't convert a public hosted zone to a private hosted zone or vice versa. ... the NS and SOA records are not...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I encountered a similar problem and found it here. @balkat solved my problem, thanks!
I just directly use hostedZoneNameServers property.
And for completeness, I was able to deploy by adding extra code to join the array returned by GetAtt into a string:
Synthed template:
Output from cloudformation deployment: