RecordSet: determineFullyQualifiedDomainName incorrectly suffixes zone name when param is passed in #26572
Labels
@aws-cdk/aws-route53
Related to Amazon Route 53
bug
This issue is a bug.
effort/medium
Medium work item – several days of effort
p2
Describe the bug
Edited for clarification:
RecordSet
attempts to be smart about the input value ofrecordName
. Typically, for a zoneexample.com
, a FQDN is required for therecordName
such astest.example.com.
. However, RecordSet'sdetermineFullyQualifiedDomainName
method attempts to fix user input in case they forgot to add the zone name turningtest
intotest.example.com
. This works great in the usual cases, except for parameterized input such as CfnCondition or imported value from another stack. ThedetermineFullyQualifiedDomainName
thinks the input does not end in the zone name and tacks it on. Whentest.example.com.
is passed in via CfnParameter, the resulting record becomestest.example.com.example.com
.Expected Behavior
Since user is expected to pass in FQDN and the helper method is intended to suffix it if missed by the user, the default should be to leave the value as is if input can't be determined and assume user supplied the correct FQDN in parameter/imported value.
Current Behavior
The logic in determineFullyQualifiedDomainName suffixes zone name if it cannot read the parameter/imported value resulting in incorrect value.
Reproduction Steps
Possible Solution
Workaround is to suffix with "." to make it a FQDN and bypass suffixing:
But this only works when you can directly supply the
recordName
. In case ofaws-route53-patterns
.HttpsRedirect
and other third party constructs, the input domain cannot contain a trailing dot as other constructs cannot have FQDN as input. Particularly forHttpsRedirect
, a single input parameter is used both for the route53 record set as well as the cloudfront ViewerCertificate. One requires the FQDN, the other fails with it making it impossible to use as is.Additional Information/Context
No response
CDK CLI Version
2.77.0
Framework Version
No response
Node.js Version
18
OS
osx 14
Language
Typescript
Language Version
4.9.5
Other information
No response
The text was updated successfully, but these errors were encountered: