-
-
Notifications
You must be signed in to change notification settings - Fork 240
feat: Added extension for alternative zone_id's for SAN's #100
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
Closed
Closed
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
f7c6548
added extension for alternative zone_id's for SAN's
c673086
Merge branch 'master' into master
ZeePal 70fb2d3
Merge github.com:terraform-aws-modules/terraform-aws-acm
5a48074
Merge branch 'master' into master
antonbabenko 97edded
Merge branch 'master' into master
antonbabenko 4111a6f
Merge branch 'master' into master
antonbabenko 552f75d
Merge branch 'master' into master
antonbabenko File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| # ACM example with Route53 DNS validation and multiple zones | ||
|
|
||
| Configuration in this directory creates a new ACM certificate which has SAN's that need a different Route53 Zone compared to `var.domain_name` to be validated. | ||
|
|
||
|
|
||
| ## Usage | ||
|
|
||
| To run this example you need to execute: | ||
|
|
||
| ```bash | ||
| $ terraform init | ||
| $ terraform plan | ||
| $ terraform apply | ||
| ``` | ||
|
|
||
| Note that this example may create resources which cost money. Run `terraform destroy` when you don't need these resources. | ||
|
|
||
| <!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> | ||
| ## Requirements | ||
|
|
||
| | Name | Version | | ||
| |------|---------| | ||
| | <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.12.26 | | ||
| | <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 2.53 | | ||
|
|
||
| ## Providers | ||
|
|
||
| | Name | Version | | ||
| |------|---------| | ||
| | <a name="provider_aws"></a> [aws](#provider\_aws) | >= 2.53 | | ||
|
|
||
| ## Modules | ||
|
|
||
| | Name | Source | Version | | ||
| |------|--------|---------| | ||
| | <a name="module_acm"></a> [acm](#module\_acm) | ../../ | n/a | | ||
|
|
||
| ## Resources | ||
|
|
||
| | Name | Type | | ||
| |------|------| | ||
| | [aws_route53_zone.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route53_zone) | resource | | ||
| | [aws_route53_zone.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/route53_zone) | data source | | ||
|
|
||
| ## Inputs | ||
|
|
||
| No inputs. | ||
|
|
||
| ## Outputs | ||
|
|
||
| | Name | Description | | ||
| |------|-------------| | ||
| | <a name="output_acm_certificate_arn"></a> [acm\_certificate\_arn](#output\_acm\_certificate\_arn) | The ARN of the certificate | | ||
| | <a name="output_acm_certificate_domain_validation_options"></a> [acm\_certificate\_domain\_validation\_options](#output\_acm\_certificate\_domain\_validation\_options) | A list of attributes to feed into other resources to complete certificate validation. Can have more than one element, e.g. if SANs are defined. Only set if DNS-validation was used. | | ||
| | <a name="output_acm_certificate_validation_emails"></a> [acm\_certificate\_validation\_emails](#output\_acm\_certificate\_validation\_emails) | A list of addresses that received a validation E-Mail. Only set if EMAIL-validation was used. | | ||
| | <a name="output_distinct_domain_names"></a> [distinct\_domain\_names](#output\_distinct\_domain\_names) | List of distinct domains names used for the validation. | | ||
| | <a name="output_validation_domains"></a> [validation\_domains](#output\_validation\_domains) | List of distinct domain validation options. This is useful if subject alternative names contain wildcards. | | ||
| | <a name="output_validation_route53_record_fqdns"></a> [validation\_route53\_record\_fqdns](#output\_validation\_route53\_record\_fqdns) | List of FQDNs built using the zone domain and name. | | ||
| <!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| locals { | ||
| primary_domain = "terraform-aws-modules.modules.tf" | ||
| extra_domain = "terraform-aws-modules.extra-modules.tf" | ||
|
|
||
| # Removing trailing dot from domain - just to be sure :) | ||
| primary_domain_name = trimsuffix(local.primary_domain, ".") | ||
| extra_domain_name = trimsuffix(local.extra_domain, ".") | ||
| } | ||
|
|
||
| data "aws_route53_zone" "primary_domain" { | ||
| name = local.primary_domain_name | ||
| private_zone = false | ||
| } | ||
|
|
||
| data "aws_route53_zone" "extra_domain" { | ||
| name = local.extra_domain_name | ||
| private_zone = false | ||
| } | ||
|
|
||
|
|
||
| module "acm" { | ||
| source = "../../" | ||
|
|
||
| domain_name = local.primary_domain_name | ||
| zone_id = data.aws_route53_zone.primary_domain.zone_id | ||
|
|
||
| subject_alternative_names = [ | ||
| "*.${local.primary_domain_name}", | ||
| { | ||
| name = "alerts.${local.extra_domain_name}" | ||
| zone_id = data.aws_route53_zone.extra_domain.zone_id | ||
| }, | ||
| { | ||
| name = "*.alerts.${local.extra_domain_name}" | ||
| zone_id = data.aws_route53_zone.extra_domain.zone_id | ||
| } | ||
| ] | ||
|
|
||
| wait_for_validation = true | ||
|
|
||
| tags = { | ||
| Name = local.primary_domain_name | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| output "acm_certificate_arn" { | ||
| description = "The ARN of the certificate" | ||
| value = module.acm.acm_certificate_arn | ||
| } | ||
|
|
||
| output "acm_certificate_domain_validation_options" { | ||
| description = "A list of attributes to feed into other resources to complete certificate validation. Can have more than one element, e.g. if SANs are defined. Only set if DNS-validation was used." | ||
| value = module.acm.acm_certificate_domain_validation_options | ||
| } | ||
|
|
||
| output "acm_certificate_validation_emails" { | ||
| description = "A list of addresses that received a validation E-Mail. Only set if EMAIL-validation was used." | ||
| value = module.acm.acm_certificate_validation_emails | ||
| } | ||
|
|
||
| output "validation_route53_record_fqdns" { | ||
| description = "List of FQDNs built using the zone domain and name." | ||
| value = module.acm.validation_route53_record_fqdns | ||
| } | ||
|
|
||
| output "distinct_domain_names" { | ||
| description = "List of distinct domains names used for the validation." | ||
| value = module.acm.distinct_domain_names | ||
| } | ||
|
|
||
| output "validation_domains" { | ||
| description = "List of distinct domain validation options. This is useful if subject alternative names contain wildcards." | ||
| value = module.acm.validation_domains | ||
| } |
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| terraform { | ||
| required_version = ">= 0.12.26" | ||
|
|
||
| required_providers { | ||
| aws = { | ||
| source = "hashicorp/aws" | ||
| version = ">= 2.53" | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 have a belief that this change won't work with terragrunt because of type
any. There is a similar issue in Route53 module.Could you change the type from
list(string)tolist(map(string))to prevent the issue?PS: I have not executed this code yet.
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.
if we change from
anytolist(map(string))it will no-longer be a backwards compatible change for pure-terraform as they currently provide alist(string).if we keep the
anyand follow the terragrunt workaround it will be backwards compatible for pure-terraform but not for terragrunt.if backwards compatibility is required for both pure-terraform & terragrunt the vars interface will need to be changed (something like a 2nd optional list of zone_ids but this isnt clean/reliable) or we bump major version to use
list(map(string)).if we going to bump the major version to use
list(map(string)), do we want to consider any other changes at the same time?current user input:
user input if
list(map(string))is required but for the same result as above: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.
hi @antonbabenko , have you had a chance to go over my previous reply & which direction we want to head?
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.
Sorry that it takes more time to process these PRs than one would expect.
I looked into #108 a few days ago, and I think the feature that this PR (#100) adds should be considered and implemented after it.
The main reason to order PRs like this is that users may want to create records using different instances of the providers (zone_id + provider). It will be easier to implement that way and update examples to show a variety of combinations.