-
Notifications
You must be signed in to change notification settings - Fork 0
/
acm.tf
32 lines (29 loc) · 1.23 KB
/
acm.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#################################################
# AWS ACM - Wildcard SSL Certificate Settings
#################################################
resource "aws_acm_certificate" "app" {
domain_name = local.app_domain
validation_method = "DNS"
subject_alternative_names = local.cert_sans
provider = aws.cert_provider
lifecycle {
create_before_destroy = true
ignore_changes = [subject_alternative_names]
}
}
resource "aws_route53_record" "cert_validations" {
count = length(local.cert_sans) + 1
zone_id = data.aws_route53_zone.public.zone_id
allow_overwrite = true
name = element(aws_acm_certificate.app.domain_validation_options.*.resource_record_name, count.index)
type = element(aws_acm_certificate.app.domain_validation_options.*.resource_record_type, count.index)
records = [element(aws_acm_certificate.app.domain_validation_options.*.resource_record_value, count.index)]
ttl = 300
}
resource "aws_acm_certificate_validation" "cert_validation" {
certificate_arn = aws_acm_certificate.app.arn
validation_record_fqdns = aws_route53_record.cert_validations.*.fqdn
timeouts {
create = "120m"
}
}