Skip to content

Commit

Permalink
Private CA: Skip validation method, correct data source input (#54)
Browse files Browse the repository at this point in the history
* Skip validation method, correct data source input

* Auto Format

Co-authored-by: nitrocode <[email protected]>
Co-authored-by: cloudpossebot <[email protected]>
  • Loading branch information
3 people authored Sep 15, 2022
1 parent d64d26e commit 32f16fe
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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" {
Expand Down

0 comments on commit 32f16fe

Please sign in to comment.