diff --git a/solutions/fully-configurable/variables.tf b/solutions/fully-configurable/variables.tf index c261c807..feb345d1 100644 --- a/solutions/fully-configurable/variables.tf +++ b/solutions/fully-configurable/variables.tf @@ -33,11 +33,9 @@ variable "prefix" { ]) ) error_message = "Prefix must begin with a lowercase letter and may contain only lowercase letters, digits, and hyphens '-'. It must not end with a hyphen('-'), and cannot contain consecutive hyphens ('--')." - } - - validation { + } validation { # must not exceed 16 characters in length - condition = length(var.prefix) <= 16 + condition = var.prefix == null || var.prefix == "" ? true : length(var.prefix) <= 16 error_message = "Prefix must not exceed 16 characters." } } diff --git a/solutions/security-enforced/variables.tf b/solutions/security-enforced/variables.tf index eb9a5a72..f945cc2a 100644 --- a/solutions/security-enforced/variables.tf +++ b/solutions/security-enforced/variables.tf @@ -33,11 +33,9 @@ variable "prefix" { ]) ) error_message = "Prefix must begin with a lowercase letter and may contain only lowercase letters, digits, and hyphens '-'. It must not end with a hyphen('-'), and cannot contain consecutive hyphens ('--')." - } - - validation { + } validation { # must not exceed 16 characters in length - condition = length(var.prefix) <= 16 + condition = var.prefix == null || var.prefix == "" ? true : length(var.prefix) <= 16 error_message = "Prefix must not exceed 16 characters." } }