Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HostedZone: Default period at the end should be optional #22406

Closed
DavidA94 opened this issue Oct 7, 2022 · 2 comments · Fixed by #25379
Closed

HostedZone: Default period at the end should be optional #22406

DavidA94 opened this issue Oct 7, 2022 · 2 comments · Fixed by #25379
Assignees
Labels
@aws-cdk/aws-route53 Related to Amazon Route 53 bug This issue is a bug. effort/small Small work item – less than a day of effort p2

Comments

@DavidA94
Copy link

DavidA94 commented Oct 7, 2022

Describe the bug

In the HostedZone constructor, a period is added to the end of the name on line 163.

This changes the user's input from github.com to github.com.. Although Route53 considers these to be identical, they cannot co-exist together. Thus, for anybody moving from CFN templates to CDK, who did not have a . at the end of their name, this line breaks their CloudFormation deployment.

Consider a user who has a CloudFormation template with the following:

CustomHostedZone:
    Type: AWS::Route53::HostedZone
    Properties:
        Name: github.com
        ...

Who then re-creates their resource in CDK, keeping the same LogicalId for the migration

new HostedZone(this, "CustomHostedZone", {
    zoneName: 'github.com'
    ...
}
overrideLogicalId("CustomHostedZone");

Because the . is added, CloudFormation will see this as a name change, and try to re-create the resource. However, Route53 will see the same domain name and block the creation because the domain already exists. Because this added . is by default, the user is only left with hacky solutions to deploy their code.

Expected Behavior

Give the user an option whether or not the . should be added at the end

Current Behavior

The user has no control over the behavior.

Reproduction Steps

Create a hosted zone with a CFN template with no trailing ., and then try to create the same HostedZone, with the LogicalId overwritten, using CDK.

Possible Solution

At this point, I believe the only viable solution is a flag (addTrailingDot?) added to the properties which is defaulted to true. Unfortunately, removing this behavior outright will break anybody's code who didn't have pre-existing resources.

If github.com. exists in a user's Route53 domain list, and the . is removed from a later release of this package, then their CDK will start deploying as github.com, which will still cause CloudFormation to try to re-create the resource, causing the same issue.

Additional Information/Context

No response

CDK CLI Version

2.43.1

Framework Version

No response

Node.js Version

14

OS

Mac

Language

Typescript

Language Version

No response

Other information

No response

@DavidA94 DavidA94 added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Oct 7, 2022
@github-actions github-actions bot added the @aws-cdk/aws-route53 Related to Amazon Route 53 label Oct 7, 2022
@pahud
Copy link
Contributor

pahud commented Nov 23, 2022

I agree with you. Sounds like we could have addTrailingDot optional prop with default True to allow users opt out. I am making this issue a P2 and any suggested solutions or pull requests are welcome!

@pahud pahud added p2 effort/small Small work item – less than a day of effort and removed needs-triage This issue or PR still needs to be triaged. labels Nov 23, 2022
@mergify mergify bot closed this as completed in #25379 May 30, 2023
mergify bot pushed a commit that referenced this issue May 30, 2023
…nal (#25379)

new flag `addTrailingDot`

The addTrailingDot option provides users with the choice to add a trailing dot (.) to the given domain name. In DNS, appending a dot at the end of a domain name indicates that the domain name is a fully qualified domain name (FQDN).
This function returns the value as is if the domain name is already an FQDN or has a trailing dot, and otherwise treats it as having a trailing dot. The existing specification was rejecting domain names with trailing dots, but this modification makes it unnecessary, so the validation check has been removed.

Closes #22406

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-route53 Related to Amazon Route 53 bug This issue is a bug. effort/small Small work item – less than a day of effort p2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants