Skip to content

Instantly share code, notes, and snippets.

@9oelM

9oelM/block46.tf Secret

Created March 21, 2021 13:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 9oelM/d36aa6fe1550e280e65ad32443be3560 to your computer and use it in GitHub Desktop.
Save 9oelM/d36aa6fe1550e280e65ad32443be3560 to your computer and use it in GitHub Desktop.
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