From 32f16fe636a5b0d9e1d987873a7ed94bd0596254 Mon Sep 17 00:00:00 2001 From: nitrocode <7775707+nitrocode@users.noreply.github.com> Date: Thu, 15 Sep 2022 08:58:40 -0500 Subject: [PATCH] Private CA: Skip validation method, correct data source input (#54) * Skip validation method, correct data source input * Auto Format Co-authored-by: nitrocode Co-authored-by: cloudpossebot <11232728+cloudpossebot@users.noreply.github.com> --- main.tf | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/main.tf b/main.tf index 5d58154..5aa9c2b 100644 --- a/main.tf +++ b/main.tf @@ -3,12 +3,15 @@ locals { zone_name = var.zone_name == "" ? "${var.domain_name}." : var.zone_name process_domain_validation_options = local.enabled && var.process_domain_validation_options && var.validation_method == "DNS" domain_validation_options_set = local.process_domain_validation_options ? aws_acm_certificate.default.0.domain_validation_options : toset([]) + public_enabled = var.certificate_authority_arn == null + private_enabled = ! local.public_enabled } resource "aws_acm_certificate" "default" { - count = local.enabled ? 1 : 0 + count = local.enabled ? 1 : 0 + domain_name = var.domain_name - validation_method = var.validation_method + validation_method = local.public_enabled ? var.validation_method : null subject_alternative_names = var.subject_alternative_names certificate_authority_arn = var.certificate_authority_arn @@ -27,7 +30,7 @@ data "aws_route53_zone" "default" { count = local.process_domain_validation_options ? 1 : 0 zone_id = var.zone_id name = try(length(var.zone_id), 0) == 0 ? local.zone_name : null - private_zone = false + private_zone = local.private_enabled } resource "aws_route53_record" "default" {