-
-
Save 9oelM/d36aa6fe1550e280e65ad32443be3560 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "aws_acm_certificate" "hello" { | |
provider = aws.default_us_east_1 | |
domain_name = "api.hello.com" | |
validation_method = "DNS" | |
tags = { | |
Environment = terraform.workspace | |
} | |
lifecycle { | |
create_before_destroy = true | |
} | |
} | |
resource "aws_acm_certificate_validation" "hello" { | |
provider = aws.default_us_east_1 | |
certificate_arn = aws_acm_certificate.hello.arn | |
validation_record_fqdns = [for record in aws_route53_record.hello : record.fqdn] | |
} | |
locals { | |
aws_route53_your_existing_zone_id = "A123A123A123A123" | |
} | |
resource "aws_route53_record" "hello" { | |
for_each = { | |
for dvo in aws_acm_certificate.hello.domain_validation_options : dvo.domain_name => { | |
name = dvo.resource_record_name | |
record = dvo.resource_record_value | |
type = dvo.resource_record_type | |
} | |
} | |
allow_overwrite = true | |
name = each.value.name | |
records = [each.value.record] | |
ttl = 60 | |
type = each.value.type | |
zone_id = local.aws_route53_your_existing_zone_id | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment