From 47fd3efd6b5c72fded8b7eb66d3e818a633bf1e0 Mon Sep 17 00:00:00 2001 From: Nick Adams Date: Mon, 19 Apr 2021 09:44:02 -0500 Subject: [PATCH] Updated vars --- main.tf | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/main.tf b/main.tf index 8b4d6f1..5bded9d 100644 --- a/main.tf +++ b/main.tf @@ -1,13 +1,13 @@ -data "aws_route53_zone" "parent_zone" { +data "aws_route53_zone" "this" { zone_id = var.r53_zone_id private_zone = false } -resource "aws_acm_certificate" "primary" { - domain_name = "${var.tenant_name}.${data.aws_route53_zone.parent_zone.name}" +resource "aws_acm_certificate" "this" { + domain_name = var.domain_name validation_method = "DNS" - subject_alternative_names = ["origin.${var.tenant_name}.${data.aws_route53_zone.parent_zone.name}"] + subject_alternative_names = var.subject_alternative_names options { certificate_transparency_logging_preference = "ENABLED" @@ -17,19 +17,12 @@ resource "aws_acm_certificate" "primary" { create_before_destroy = true } - tags = merge( - var.tags, - { - Name = "${var.tenant_name}-primary", - SaaSResoure = true, - DedicatedToTenant = true, - }, - ) + tags = var.tags } -resource "aws_route53_record" "acm_validation" { +resource "aws_route53_record" "this" { for_each = { - for dvo in aws_acm_certificate.primary.domain_validation_options : dvo.domain_name => { + 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 @@ -39,14 +32,14 @@ resource "aws_route53_record" "acm_validation" { allow_overwrite = true name = each.value.name records = [each.value.record] - ttl = 60 + ttl = var.ttl type = each.value.type zone_id = var.r53_zone_id } -resource "aws_acm_certificate_validation" "primary" { - certificate_arn = aws_acm_certificate.primary.arn - validation_record_fqdns = [for record in aws_route53_record.acm_validation : record.fqdn] +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] timeouts { create = "60m"