From aa4f14d08da4e51e729187753e96ea39bba6d00e Mon Sep 17 00:00:00 2001 From: badra001 Date: Thu, 6 Apr 2023 15:40:54 -0400 Subject: [PATCH] fix zone, for things like A.B.domain where domain is what is defined --- common/common.tf | 2 +- common/variables.tf | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/common/common.tf b/common/common.tf index b3c492a..412e6ba 100644 --- a/common/common.tf +++ b/common/common.tf @@ -12,7 +12,7 @@ locals { locals { name_parts = split(".", var.name) host_name = local.name_parts[0] - zone = trimprefix(var.name, format("%v.", local.host_name)) + zone = var.zone == null || var.zone == "" ? trimprefix(var.name, format("%v.", local.host_name)) : var.zone private_zone = local.account_environment == "gov" ? true : var.private_zone rr_type = upper(local.record_type) default_enable_ptr = lookup(local._defaults.enable_ptr, local.record_type, false) diff --git a/common/variables.tf b/common/variables.tf index 0c83c5d..d04b114 100644 --- a/common/variables.tf +++ b/common/variables.tf @@ -1,8 +1,8 @@ -# variable "zone" { -# description = "DNS Zone into which to create the record. By default, it will extract this from the name" -# type = string -# default = null -# } +variable "zone" { + description = "DNS Zone into which to create the record. By default, it will extract this from the name after the first dot." + type = string + default = null +} variable "name" { description = "FQDN DNS name to create. If the zone (everything after the first dot) does not exist or is not associated to the VPC, this creation will fail."