diff --git a/cra-config.yaml b/cra-config.yaml index 02ae2ae2..cc9ec8ed 100644 --- a/cra-config.yaml +++ b/cra-config.yaml @@ -7,6 +7,6 @@ CRA_TARGETS: CRA_ENVIRONMENT_VARIABLES: TF_VAR_existing_kms_instance_crn: "crn:v1:bluemix:public:hs-crypto:us-south:a/abac0df06b644a9cabc6e44f55b3880e:e6dce284-e80f-46e1-a3c1-830f7adff7a9::" TF_VAR_kms_key_crn: "crn:v1:bluemix:public:hs-crypto:us-south:a/abac0df06b644a9cabc6e44f55b3880e:e6dce284-e80f-46e1-a3c1-830f7adff7a9:key:76170fae-4e0c-48c3-8ebe-326059ebb533" - TF_VAR_prefix: "test-postgres-standard" + TF_VAR_prefix: "test-postgres" TF_VAR_resource_group_name: "test" TF_VAR_provider_visibility: "public" diff --git a/solutions/standard/variables.tf b/solutions/standard/variables.tf index 220555f4..705b1887 100644 --- a/solutions/standard/variables.tf +++ b/solutions/standard/variables.tf @@ -41,6 +41,10 @@ variable "prefix" { type = string description = "Prefix to add to all resources created by this solution." default = null + validation { + error_message = "Prefix must begin with a lowercase letter and contain only lowercase letters, numbers, and - characters. Prefixes must end with a lowercase letter or number and be 16 or fewer characters." + condition = can(regex("^([a-z]|[a-z][-a-z0-9]*[a-z0-9])$", coalesce(var.prefix, "postgres"))) && length(coalesce(var.prefix, "postgres")) <= 16 + } } variable "name" {