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

fix(route53): return plain hosted zone id without /hostedzone/ prefix #5230

Merged
merged 9 commits into from
Dec 12, 2019

Conversation

AlexZeitler
Copy link
Contributor

@AlexZeitler AlexZeitler commented Nov 27, 2019

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

fixes #4744


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

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`
@mergify
Copy link
Contributor

mergify bot commented Nov 27, 2019

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
merged. In the meantime, please take a minute to make sure you follow this
checklist
:

  • PR title type(scope): text
    • type: fix, feat, refactor go into CHANGELOG, chore is hidden
    • scope: name of module without aws- or cdk- prefix or postfix (e.g. s3 instead of aws-s3-deployment)
    • text: use all lower-case, do not end with a period, do not include issue refs
  • PR Description
    • Rationale: describe rationale of change and approach taken
    • Issues: indicate issues fixed via: fixes #xxx or closes #xxx
    • Breaking?: last paragraph: BREAKING CHANGE: <describe what changed + link for details>
  • Testing
    • Unit test added. Prefer to add a new test rather than modify existing tests
    • CLI or init templates change? Re-run/add CLI integration tests
  • Documentation
    • README: update module README to describe new features
    • API docs: public APIs must be documented. Copy from official AWS docs when possible
    • Design: for significant features, follow design process

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

eladb
eladb previously requested changes Nov 29, 2019
@@ -15,8 +15,9 @@ export = {
const missing = SynthUtils.synthesize(stack).assembly.manifest.missing!;
test.ok(missing && missing.length === 1);

const fakeZoneId = '11111111111111';
const fakeZone = {
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, please see 667f65f

@mergify mergify bot dismissed eladb’s stale review November 29, 2019 08:48

Pull request has been modified.

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

add hostedZoneArn attribute & tests.
@AlexZeitler AlexZeitler requested a review from SoManyHs as a code owner December 8, 2019 02:08
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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}
Copy link
Contributor

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/', '');
Copy link
Contributor

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\//, '')

Comment on lines -10 to +13
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' };
Copy link
Contributor

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)

Comment on lines -19 to +24
Id: "/hostedzone/11111111111111",
Name: "example.com.",
CallerReference: "TestLates-PublicZo-OESZPDFV7G6A",
Id: `/hostedzone/${fakeZoneId}`,
Name: 'example.com.',
CallerReference: 'TestLates-PublicZo-OESZPDFV7G6A',
Copy link
Contributor

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.

@shivlaks shivlaks added the pr/do-not-merge This PR should not be merged at this time. label Dec 12, 2019
@shivlaks shivlaks merged commit 5e08753 into aws:master Dec 12, 2019
@AlexZeitler AlexZeitler deleted the plain-hostedzone-id-from-lookup branch December 12, 2019 18:05
ed-at-work pushed a commit to ed-at-work/aws-cdk that referenced this pull request Dec 17, 2019
…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`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr/do-not-merge This PR should not be merged at this time.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

route53: HostedZone should have a hostedZoneArn property
4 participants