fix(route53): determineFullyQualifiedDomainName output ends with two periods when hostedzone.zonename is token#20435
Conversation
peterwoodworth
left a comment
There was a problem hiding this comment.
Thanks for the PR @tezz-io! There are a few things we need to address 🙂
| * </ul> | ||
| */ | ||
| export function determineFullyQualifiedDomainName(providedName: string, hostedZone: IHostedZone): string { | ||
| export function determineFullyQualifiedDomainName(providedName: string, hostedZone: IHostedZone, forceRemovePeriodProp?: boolean): string { |
There was a problem hiding this comment.
I'm not a fan of the name forceRemovePeriodProp - I used that as an example. forceRemovePeriod is fine, but honestly I'm not great at coming up with names. If you have any other suggestions, feel free. Something descriptive like removeDomainNamePeriod is much better in my opinion.
| value: 'domain.com.', | ||
| exportName: 'zoneNameExample', | ||
| }); | ||
|
|
There was a problem hiding this comment.
Remove this empty line here, we don't want any empty lines unless they're between the given / when / then clauses
|
|
||
| // WHEN | ||
| const providedName = 'test'; | ||
| new cdk.CfnOutput(stack, 'zoneNameExample', { |
There was a problem hiding this comment.
You shouldn't actually need to create a CfnOutput for the importValue to reference for this test to succeed
| * </ul> | ||
| */ | ||
| export function determineFullyQualifiedDomainName(providedName: string, hostedZone: IHostedZone): string { | ||
| export function determineFullyQualifiedDomainName(providedName: string, hostedZone: IHostedZone, forceRemovePeriodProp?: boolean): string { |
There was a problem hiding this comment.
This function looks great, but this functionality isn't exposed to the user, nor is it being used anywhere where we call this function in the code. So right now, this still isn't doing anything.
This function is called here
It will get used whenever a
RecordSet or any of the constructs that extend it are created. So, this option needs to be present for all of those constructs.We can easily accomplish this by adding the prop to
RecordSetOptions
Pull request has been modified.
|
Hi @peterwoodworth, I fixed all of the issues, but |
| * </ul> | ||
| */ | ||
| export function determineFullyQualifiedDomainName(providedName: string, hostedZone: IHostedZone): string { | ||
| export function determineFullyQualifiedDomainName(providedName: string, hostedZone: IHostedZone, removeDomainNamePeriodEnd?: boolean): string { |
There was a problem hiding this comment.
This function is interesting.
Is there any scenario the removeDomainNamePeriodEnd should be false with the imported HostedZone?
There was a problem hiding this comment.
If we know the imported hostedZone.zoneName is not a FQDN, e.g., "github.com". If it is ensured that it will be FQDN then with just !Token.isUnresolved(hostedZoneName) condition is enough.
|
Hi @neilkuan @robertd @misterjoshua Any comments on this PR? Would love to hear more feedbacks. |
TheRealAmazonKendra
left a comment
There was a problem hiding this comment.
Looks like our branch change over to v2 caused some branch conflicts. Could you please resolve these?
Pull request has been modified.
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
|
@TheRealAmazonKendra the issues have been resolved, this is ready for full review. What do you think about this solution? |
|
@comcalvi and I have been discussing this one and I don't think this is the right solution. We also noted that this is an issue that we have in various contexts so we're looking into a generic larger scale fix. |
Because `route53.determineFullyQualifiedDomainName()` doesn't correctly handles tokens we get the zone name twice here. Another way to solve this would be to fix `determineFullyQualifiedDomainName()`. There is already a discussion there aws#20435 for the hosted zone name part, not the record name. Closes aws#21306
|
There's also an issue when the Would be great if this could also be fixed in this PR => |
|
Given that this is not the direction we want to take with this, I'm going to go ahead and close this PR. We can continue the conversation of alternative fixes in the issue. This may require us to make a breaking change and put this under a feature flag but it seems that the impacts of this bug are pretty wide reaching so doing so would likely be worth it to do so. |
Because `route53.determineFullyQualifiedDomainName()` doesn't correctly handles tokens we get the zone name twice here. Another way to solve this would be to fix `determineFullyQualifiedDomainName()`. There is already a discussion there #20435 for the hosted zone name part, not the record name. Closes #21306 ---- ### All Submissions: * [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) ### Adding new Unconventional Dependencies: * [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies) ### New Features * [x] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)? * [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)? *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Added forceRemovePeriodProp prop which can forcefully remove the period if desired by the user fixes #20389
All Submissions:
Adding new Unconventional Dependencies:
New Features
yarn integto deploy the infrastructure and generate the snapshot (i.e.yarn integwithout--dry-run)?By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license