mirror of
https://github.com/kasmtech/terraform.git
synced 2026-01-23 10:25:48 +00:00
31 lines
888 B
HCL
31 lines
888 B
HCL
resource "aws_acm_certificate" "this" {
|
|
domain_name = var.aws_domain_name
|
|
subject_alternative_names = ["*.${var.aws_domain_name}"]
|
|
validation_method = "DNS"
|
|
|
|
lifecycle {
|
|
create_before_destroy = true
|
|
}
|
|
}
|
|
|
|
resource "aws_route53_record" "this" {
|
|
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
|
|
}
|
|
}
|
|
name = each.value.name
|
|
type = each.value.type
|
|
records = [each.value.record]
|
|
zone_id = data.aws_route53_zone.this.id
|
|
|
|
ttl = 30
|
|
allow_overwrite = true
|
|
}
|
|
|
|
resource "aws_acm_certificate_validation" "this" {
|
|
certificate_arn = aws_acm_certificate.this.arn
|
|
validation_record_fqdns = [for record in aws_route53_record.this : record.fqdn]
|
|
}
|