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): warn CrossAccountZoneDelegationRecord delegatedZone Name Server undefined #30602

Closed
wants to merge 2 commits into from

Conversation

samson-keung
Copy link
Contributor

Issue # (if applicable)

Closes #30600.

Reason for this change

See #30440 (comment)

TLDR: This PR unblocks users who use other ways to retrieve delegated zone name servers

Description of changes

Covert the throw Error into addWarning

Description of how you validated changes

Unit test added

Checklist


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

@github-actions github-actions bot added bug This issue is a bug. effort/small Small work item – less than a day of effort p1 labels Jun 20, 2024
@aws-cdk-automation aws-cdk-automation requested a review from a team June 20, 2024 18:06
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Jun 20, 2024
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

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

The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.

A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed add Clarification Request to a comment.

@samson-keung samson-keung changed the title fix(aws-route53): warn CrossAccountZoneDelegationRecord delegatedZone Name Server undefined fix(route53): warn CrossAccountZoneDelegationRecord delegatedZone Name Server undefined Jun 20, 2024
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 0fc9a5e
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@samson-keung
Copy link
Contributor Author

Exemption Request

Reason: The change affects build time. No changes to deployment behaviour, hence, no integ test update

@aws-cdk-automation aws-cdk-automation added the pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback. label Jun 20, 2024
@samson-keung samson-keung marked this pull request as ready for review June 20, 2024 19:20
@comcalvi comcalvi added the pr-linter/exempt-integ-test The PR linter will not require integ test changes label Jun 21, 2024
@aws-cdk-automation aws-cdk-automation dismissed their stale review June 21, 2024 01:43

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

@aws-cdk-automation aws-cdk-automation added the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Jun 21, 2024
@@ -930,7 +930,8 @@ export class CrossAccountZoneDelegationRecord extends Construct {
}

if (!props.delegatedZone.hostedZoneNameServers) {
throw Error(`Not able to retrieve Name Servers for ${props.delegatedZone.zoneName} due to it being imported.`);
Annotations.of(this).addWarningV2('@aws-cdk/aws-route53:importedDelegatedZoneNSValidation',
`Not able to retrieve Name Servers for \'${props.delegatedZone.zoneName}\' due to it being imported. Use a non-imported one or use AwsCustomResource to retrieve the Name Servers.`);
Copy link
Contributor

Choose a reason for hiding this comment

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

how do we know this is imported? Not specified doesn't mean that it's been imported.

@aws-cdk-automation aws-cdk-automation removed the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Jun 21, 2024
@@ -930,7 +930,8 @@ export class CrossAccountZoneDelegationRecord extends Construct {
}

if (!props.delegatedZone.hostedZoneNameServers) {
throw Error(`Not able to retrieve Name Servers for ${props.delegatedZone.zoneName} due to it being imported.`);
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of throwing here we could change this line linked from the original issue:

ResourceRecords: DelegatedZoneNameServers.map(ns => ({ Value: ns })),

to read:

 ResourceRecords: (DelegatedZoneNameServers ?? []).map(ns => ({ Value: ns })), 

but that change would need to be carefully integ tested, we've recently seen issues from passing empty arrays around the custom resource handler framework.

@TheRealAmazonKendra
Copy link
Contributor

Quick FYI here, when you submit a fix, the title should describe the bug, not the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. contribution/core This is a PR that came from AWS. effort/small Small work item – less than a day of effort p1 pr-linter/exempt-integ-test The PR linter will not require integ test changes pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback.
Projects
None yet
4 participants