Skip to content

Commit

Permalink
feat: add acm for cloudfront #67
Browse files Browse the repository at this point in the history
  • Loading branch information
nvernooy committed Jul 25, 2023
1 parent d291d18 commit 58617c2
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions {{cookiecutter.project_slug}}/terraform/modules/application/acm.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
resource "aws_acm_certificate" "cert" {
domain_name = var.domain
validation_method = "DNS"

lifecycle {
create_before_destroy = true
}
}

resource "aws_route53_record" "cert" {
name = tolist(aws_acm_certificate.cert.domain_validation_options)[0].resource_record_name
type = tolist(aws_acm_certificate.cert.domain_validation_options)[0].resource_record_type
zone_id = data.aws_route53_zone.route_zone.id
records = [tolist(aws_acm_certificate.cert.domain_validation_options)[0].resource_record_value]
ttl = 300
}

resource "aws_acm_certificate_validation" "cert" {
certificate_arn = aws_acm_certificate.cert.arn
validation_record_fqdns = aws_route53_record.cert.*.fqdn
}

0 comments on commit 58617c2

Please # to comment.