diff --git a/solutions/fully-configurable/variables.tf b/solutions/fully-configurable/variables.tf index c261c807..94fe13f6 100644 --- a/solutions/fully-configurable/variables.tf +++ b/solutions/fully-configurable/variables.tf @@ -36,11 +36,18 @@ variable "prefix" { } validation { - # must not exceed 16 characters in length - condition = length(var.prefix) <= 16 - error_message = "Prefix must not exceed 16 characters." - } -} + + + # must not exceed 16 characters in length + + + condition = var.prefix == null || var.prefix == "" ? true : length(var.prefix) <= 16 + + + error_message = "Prefix must not exceed 16 characters." + + + }} variable "name" { type = string diff --git a/solutions/security-enforced/variables.tf b/solutions/security-enforced/variables.tf index eb9a5a72..dde9894a 100644 --- a/solutions/security-enforced/variables.tf +++ b/solutions/security-enforced/variables.tf @@ -36,11 +36,18 @@ variable "prefix" { } validation { - # must not exceed 16 characters in length - condition = length(var.prefix) <= 16 - error_message = "Prefix must not exceed 16 characters." - } -} + + + # must not exceed 16 characters in length + + + condition = var.prefix == null || var.prefix == "" ? true : length(var.prefix) <= 16 + + + error_message = "Prefix must not exceed 16 characters." + + + }} variable "name" { type = string