Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
jordi.bru committed May 23, 2024
1 parent c0292c7 commit 25aeb29
Showing 2 changed files with 6 additions and 19 deletions.
21 changes: 2 additions & 19 deletions main.tf
Original file line number Diff line number Diff line change
@@ -15,28 +15,11 @@ resource "aws_acm_certificate" "domain_certificate" {
}
}

# record validation
resource "aws_route53_record" "cert_validations" {
for_each = var.validate_cert ? {
for dvo in aws_acm_certificate.domain_certificate.domain_validation_options : dvo.domain_name => {
name = dvo.resource_record_name
record = dvo.resource_record_value
type = dvo.resource_record_type
}
} : {}

allow_overwrite = true
name = each.value.name
records = [each.value.record]
ttl = 60
type = each.value.type
zone_id = var.zone_id
}

resource "aws_acm_certificate_validation" "validations" {
count = var.validate_cert ? 1 : 0
certificate_arn = aws_acm_certificate.domain_certificate.arn
validation_record_fqdns = [for record in aws_route53_record.cert_validations : record.fqdn]
#validation_record_fqdns = [for record in aws_route53_record.cert_validations : record.fqdn]
validation_record_fqdns = [for record in var.cert_record : record.fqdn]

provider = aws.us-east-1-acm
}
4 changes: 4 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
@@ -53,4 +53,8 @@ variable "zone_id" {
description = "route53 zone id"
type = string
default = ""
}

variable "cert_record" {

}

0 comments on commit 25aeb29

Please sign in to comment.