Skip to content

Commit

Permalink
WIP: Add checks for validate_certificate
Browse files Browse the repository at this point in the history
  • Loading branch information
jbouse committed Feb 5, 2021
1 parent 627b0eb commit 2a2a134
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ locals {
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, "\\*\\.", ""))] : []

host_to_zone_regex = "/^(?:.*\\.)?([^.]+\\.[^.]+)$/"
zone_id_map = zipmap(local.distinct_domain_names, data.aws_route53_zone.this.*.zone_id)
zone_id_map = var.validate_certificate ? zipmap(local.distinct_domain_names, data.aws_route53_zone.this.*.zone_id) : {}
}

data "aws_route53_zone" "this" {
count = length(local.distinct_domain_names)
count = var.create_certificate && var.validation_method == "DNS" && var.validate_certificate ? length(local.distinct_domain_names) : 0

name = replace(local.distinct_domain_names[count.index], local.host_to_zone_regex, "$1")
private_zone = false
Expand Down

0 comments on commit 2a2a134

Please sign in to comment.