Skip to content

Instantly share code, notes, and snippets.

@HunterLarco
Created February 4, 2021 18:08
Show Gist options
  • Save HunterLarco/85d3c459aef5388b8d9b2709b1b9c52f to your computer and use it in GitHub Desktop.
Save HunterLarco/85d3c459aef5388b8d9b2709b1b9c52f to your computer and use it in GitHub Desktop.
resource "aws_acm_certificate" "this" {
domain_name = "painted.nyc"
subject_alternative_names = ["www.painted.nyc"]
validation_method = "DNS"
}
resource "aws_route53_record" "certificate_validation" {
for_each = {
for dvo in aws_acm_certificate.this.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.zones.painted_nyc.zone_id
}
resource "aws_acm_certificate_validation" "this" {
certificate_arn = aws_acm_certificate.this.arn
validation_record_fqdns = [
for record in aws_route53_record.certificate_validation : record.fqdn
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment