Skip to content

Commit 891d495

Browse files
authored
fix: create missing validation records in cases (eg, wildcard SAN) (#89)
1 parent 6595b86 commit 891d495

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Terraform module which creates ACM certificates and validates them using Route53
77
```hcl
88
module "acm" {
99
source = "terraform-aws-modules/acm/aws"
10-
version = "~> v3.0"
10+
version = "~> 3.0"
1111
1212
domain_name = "my-domain.com"
1313
zone_id = "Z2ES7B9AZ6SHAE"

examples/complete-dns-validation/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ module "acm" {
3030
"*.alerts.${local.domain_name}",
3131
"new.sub.${local.domain_name}",
3232
"*.${local.domain_name}",
33+
"alerts.${local.domain_name}",
3334
]
3435

3536
wait_for_validation = true

main.tf

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,13 @@ locals {
44
[for s in concat([var.domain_name], var.subject_alternative_names) : replace(s, "*.", "")]
55
)
66

7-
# Copy domain_validation_options for the distinct domain names
8-
validation_domains = var.create_certificate ? [for k, v in aws_acm_certificate.this[0].domain_validation_options : tomap(v) if contains(local.distinct_domain_names, replace(v.domain_name, "*.", ""))] : []
7+
# Get the list of distinct domain_validation_options, with wildcard
8+
# domain names replaced by the domain name
9+
validation_domains = var.create_certificate ? distinct(
10+
[for k, v in aws_acm_certificate.this[0].domain_validation_options : merge(
11+
tomap(v), { domain_name = replace(v.domain_name, "*.", "") }
12+
)]
13+
) : []
914
}
1015

1116
resource "aws_acm_certificate" "this" {

0 commit comments

Comments
 (0)