-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.tf
36 lines (30 loc) · 998 Bytes
/
main.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
33
34
35
36
resource "aws_acm_certificate" "this" {
domain_name = var.domain_name
subject_alternative_names = [join(".", ["*", var.domain_name])]
validation_method = "DNS"
tags = {
Name = var.name
Module = path.module
Workspace = terraform.workspace
}
lifecycle {
create_before_destroy = true
}
}
resource "aws_route53_record" "this" {
name = aws_acm_certificate.this.domain_validation_options[0]["resource_record_name"]
type = aws_acm_certificate.this.domain_validation_options[0]["resource_record_type"]
zone_id = data.aws_route53_zone.this.zone_id
records = [aws_acm_certificate.this.domain_validation_options[0]["resource_record_value"]]
ttl = 60
lifecycle {
create_before_destroy = true
}
}
resource "aws_acm_certificate_validation" "this" {
certificate_arn = aws_acm_certificate.this.arn
validation_record_fqdns = [aws_route53_record.this.fqdn]
lifecycle {
create_before_destroy = true
}
}