forked from turnerlabs/terraform-ecs-fargate-apigateway
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cert.tf
21 lines (18 loc) · 710 Bytes
/
cert.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
resource "aws_acm_certificate" "main" {
domain_name = var.domain
validation_method = "DNS"
lifecycle {
create_before_destroy = true
}
}
resource "aws_route53_record" "cert_validation" {
name = aws_acm_certificate.main.domain_validation_options[0].resource_record_name
type = aws_acm_certificate.main.domain_validation_options[0].resource_record_type
zone_id = data.aws_route53_zone.main.id
records = [aws_acm_certificate.main.domain_validation_options[0].resource_record_value]
ttl = 60
}
resource "aws_acm_certificate_validation" "main" {
certificate_arn = aws_acm_certificate.main.arn
validation_record_fqdns = [aws_route53_record.cert_validation.fqdn]
}