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

feat: Allow multiple domains in one cert #137

Conversation

amontalban
Copy link
Contributor

@amontalban amontalban commented Sep 13, 2023

Description

This PR allows creating one ACM certificate for multiple domains, which, is useful when using the certificate for CloudFront that only allows one certificate per distribution.

Motivation and Context

CloudFront does not support multiple ACM certificates, like ALB. Therefore, if you need to support multiple domains in a single CloudFront distribution you would have to create the certificate manually because this module does not support it.

Breaking Changes

This change should be backward compatible as I added a zones var containing a map with domains and their Route53 zone ID so the validation records are created in the correct Route53 zone.

Additionally, I have updated the tests in examples/complete-dns-validation to allow variables so it was easier for me (and others) to test with my test domains.

How Has This Been Tested?

  • I have updated at least one of the examples/* to demonstrate and validate my change(s)
  • I have tested and validated these changes using one or more of the provided examples/* projects
  • I have executed pre-commit run -a on my pull request

Fixes #136

@amontalban amontalban changed the title feat: Allow multiple domains in one cert Allow multiple domains in one cert Sep 13, 2023
@amontalban amontalban changed the title Allow multiple domains in one cert feat: Allow multiple domains in one cert Sep 13, 2023
@amontalban
Copy link
Contributor Author

@antonbabenko Do you think this is good to be merged? I have tested with my use case but I don't have access to the zones/domains that are described in the test cases so cannot fully validate it is a breaking change or not.

Thank you!

Copy link
Member

@antonbabenko antonbabenko left a comment

Choose a reason for hiding this comment

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

It looks pretty good, but small updates are necessary. Please make examples 100% working and verify them yourself (for e.g., by providing your own domain names via terraform.tfvars). Also, set required validation_method argument.

Also, update main README.md and include code snippet for multi-domain ACM in the same fashion as with other snippets.

@@ -32,8 +35,7 @@ module "acm" {
source = "../../"

providers = {
aws.acm = aws,
aws.dns = aws
aws = aws.acm
Copy link
Member

Choose a reason for hiding this comment

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

While your change is valid, please revert to show that there can be two distinct providers passed to the module.

@@ -60,11 +62,13 @@ module "acm" {
################################################################

provider "aws" {
alias = "route53"
alias = "route53"
region = local.region
Copy link
Member

Choose a reason for hiding this comment

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

Please revert all changes not necessary for your PR.

##########################################################

provider "aws" {
region = local.region
Copy link
Member

Choose a reason for hiding this comment

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

Please remove region as it is not important for this example.


# Removing trailing dot from domain - just to be sure :)
domain_name = trimsuffix(local.domain, ".")

region = "us-east-1"
Copy link
Member

Choose a reason for hiding this comment

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

Please remove this region, too.

}

variable "extra_domain" {
description = "Extr adomain to be used for the tests"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
description = "Extr adomain to be used for the tests"
description = "Extra domain to be used in acm_multi_domain module"

@vishwa-trulioo
Copy link

Any update on this merge?

@bryantbiggs
Copy link
Member

changes have been requested but not implemented as shown above, so it won't be merged until resolved

Copy link

github-actions bot commented Dec 3, 2023

This PR has been automatically marked as stale because it has been open 30 days
with no activity. Remove stale label or comment or this PR will be closed in 10 days

@github-actions github-actions bot added the stale label Dec 3, 2023
Copy link

This PR was automatically closed because of stale in 10 days

@github-actions github-actions bot closed this Dec 14, 2023
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 13, 2024
@amontalban amontalban deleted the am/allow_multiple_zones branch July 4, 2024 19:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ability to support multiple hostnames and DNS zones
4 participants