-
Notifications
You must be signed in to change notification settings - Fork 4k
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
fix(route53): return plain hosted zone id without /hostedzone/ prefix #5230
fix(route53): return plain hosted zone id without /hostedzone/ prefix #5230
Conversation
When creating a HostedZone, the `hostedZoneId` is the ID of this hosted zone, such as "Z23ABC4XYZL05B". Until how, when importing a HostedZone using route53.HostedZone.fromLookup, it did return the `hostedZoneId` in this format: /hostedzone/Z23ABC4XYZL05B. This commit makes the value of `hostedZoneId` consistent between creating a new `HostedZone`, using `HostedZone.fromLookup` and `fromHostedZoneAttributes`. BREAKING CHANGE: value of `hostedZoneId` is now be different compared to previous versions of CDK when using `HostedZone.fromLookup` or `fromHostedZoneAttributes`
Thanks so much for taking the time to contribute to the AWS CDK ❤️ We will shortly assign someone to review this pull request and help get it
|
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
@@ -15,8 +15,9 @@ export = { | |||
const missing = SynthUtils.synthesize(stack).assembly.manifest.missing!; | |||
test.ok(missing && missing.length === 1); | |||
|
|||
const fakeZoneId = '11111111111111'; | |||
const fakeZone = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a test which verifies that if users pass a hosted zone without the “/hostedzone” prefix, we still get the desired effect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, please see 667f65f
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
add hostedZoneArn attribute & tests.
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
@@ -16,6 +16,13 @@ export interface IHostedZone extends IResource { | |||
*/ | |||
readonly zoneName: string; | |||
|
|||
/** | |||
* ARN of this hosted zone, such as arn:${Partition}:route53:::hostedzone/${Id} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change arn:${partition}...
to a concrete example of an ARN
@@ -94,6 +103,8 @@ export class HostedZone extends Resource implements IHostedZone { | |||
response.Name = response.Name.substring(0, response.Name.length - 1); | |||
} | |||
|
|||
response.Id = response.Id.replace('/hostedzone/', ''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change to regex so it matches only the beginning of the string: replace(/^\/hostedzone\//, '')
const stack = new cdk.Stack(undefined, 'TestStack', { env: { account: '12345', region: 'us-east-1' } }); | ||
const filter = {domainName: 'test.com'}; | ||
const stack = new cdk.Stack(undefined, 'TestStack', { | ||
env: { account: '12345', region: 'us-east-1' } | ||
}); | ||
const filter = { domainName: 'test.com' }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To improve code reviewer experience, try to avoid formatting changes (it's hard to ensure that there are no functional changes here)
Id: "/hostedzone/11111111111111", | ||
Name: "example.com.", | ||
CallerReference: "TestLates-PublicZo-OESZPDFV7G6A", | ||
Id: `/hostedzone/${fakeZoneId}`, | ||
Name: 'example.com.', | ||
CallerReference: 'TestLates-PublicZo-OESZPDFV7G6A', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer it if this code was completely reverted to demonstrate there is no regression.
…aws#5230) When creating a HostedZone, the `hostedZoneId` is the ID of this hosted zone, such as "Z23ABC4SAMPLE". Until how, when importing a HostedZone using route53.HostedZone.fromLookup, it did return the `hostedZoneId` in this format: /hostedzone/Z23ABC4SAMPLE. This commit makes the value of `hostedZoneId` consistent between creating a new `HostedZone`, using `HostedZone.fromLookup` and `fromHostedZoneAttributes`. BREAKING CHANGE: the value of `hostedZoneId` will no longer include `/hostedzone/` prefix and only includes the hostedZoneId when using `HostedZone.fromLookup` or `fromHostedZoneAttributes`
When creating a HostedZone, the
hostedZoneId
is the ID of this hosted zone, such as"Z23ABC4XYZL05B"
.Until how, when importing a HostedZone using route53.HostedZone.fromLookup, it did return the
hostedZoneId
in this format:"/hostedzone/Z23ABC4XYZL05B"
.This commit makes the value of
hostedZoneId
consistent between creating a newHostedZone
, usingHostedZone.fromLookup
andfromHostedZoneAttributes
.BREAKING CHANGE: value of
hostedZoneId
is now be different compared to previous versions of CDK when usingHostedZone.fromLookup
orfromHostedZoneAttributes
fixes #4744
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license