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(cloudfront): requirement of domainNames prevents moving a domain name between distributions #31001

Merged
merged 5 commits into from
Aug 21, 2024

Conversation

Tietew
Copy link
Contributor

@Tietew Tietew commented Aug 1, 2024

Issue # (if applicable)

Closes #29960.

Reason for this change

When I want to move a domain name from a distribution to another distribution,
I must create a distribution with a certificate associated but no domain names.

Description of changes

Re-submit of previous #29329.
Removed the validation that domainNames must not be blank when a certificate is associated.

Description of how you validated changes

Updated a unit test to allow absent domainNames when a certificate is associated.

See AWS Documentation for details: Using custom URLs by adding alternate domain names (CNAMEs) > Moving an alternate domain name to a different distribution
https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/CNAMEs.html#alternate-domain-names-move

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/medium Medium work item – several days of effort p2 labels Aug 1, 2024
@aws-cdk-automation aws-cdk-automation requested a review from a team August 1, 2024 07:06
@github-actions github-actions bot added the admired-contributor [Pilot] contributed between 13-24 PRs to the CDK label Aug 1, 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.

@Tietew
Copy link
Contributor Author

Tietew commented Aug 1, 2024

Exemption Request

There are no integ tests for a distribution with certificate.

@aws-cdk-automation aws-cdk-automation added pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback. pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. labels Aug 1, 2024
@gracelu0
Copy link
Contributor

Exemption Request

There are no integ tests for a distribution with certificate.

Hi @Tietew , are there any issues preventing us from adding such an integ test? If not it would be great if you could add one as part of this PR.

@Tietew
Copy link
Contributor Author

Tietew commented Aug 14, 2024

@gracelu0 Thank you for your comment.

Integ test for this PR needs an issued public ACM certificate, which requires a reachable DNS zone (Route53 public hosted zone).
I can run tests using my private domain, but others cannot reproduce it with the same domain.
They seem a reason why integ tests do not exist currently for distributions with certificate.
Unit tests may cover whether the generated template is correct.

@gracelu0 gracelu0 added pr-linter/exempt-integ-test The PR linter will not require integ test changes and removed pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback. labels Aug 19, 2024
@aws-cdk-automation aws-cdk-automation dismissed their stale review August 19, 2024 18:31

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

* you should add (at least one of) the domain names of the certificate to this list.
*
* When you want to move a domain name between distributions, you can associate a certificate without specifying any domain names.
* See [Moving an alternate domain name to a different distribution](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/CNAMEs.html#alternate-domain-names-move) for details.
Copy link
Contributor

Choose a reason for hiding this comment

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

Reading the docs, I see that moving the domain name requires calling the associate-alias CLI command. So this change just allows the user to create a target distribution but they would still need to call associate-alias correct? I think it would be helpful to include an example of how someone would do this in CDK in the README.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. We should call associate-alias cli command manually.
I will add the instructions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've added a new section to the README.
Thanks for your suggestion!

@aws-cdk-automation aws-cdk-automation removed the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Aug 19, 2024
@mergify mergify bot dismissed gracelu0’s stale review August 21, 2024 07:20

Pull request has been modified.

@aws-cdk-automation aws-cdk-automation added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Aug 21, 2024
Copy link
Contributor

@gracelu0 gracelu0 left a comment

Choose a reason for hiding this comment

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

LGTM, thank you for contributing!

Copy link
Contributor

mergify bot commented Aug 21, 2024

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation aws-cdk-automation removed the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Aug 21, 2024
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

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

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

@mergify mergify bot merged commit acdf7d3 into aws:main Aug 21, 2024
12 checks passed
Copy link
Contributor

mergify bot commented Aug 21, 2024

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

Copy link

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 21, 2024
@Tietew Tietew deleted the cloudfront-allow-move-domainname branch August 22, 2024 02:33
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
admired-contributor [Pilot] contributed between 13-24 PRs to the CDK bug This issue is a bug. effort/medium Medium work item – several days of effort p2 pr-linter/exempt-integ-test The PR linter will not require integ test changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

aws-cloudfront: cdk incorrectly prevents attaching certificate when no aliases are given
3 participants