From 0b87fe8711e554543ef6ade66f3aa54333012974 Mon Sep 17 00:00:00 2001 From: Aditya-ranjan-16 Date: Tue, 28 Oct 2025 10:03:31 +0530 Subject: [PATCH] feat: Add UI regex validation --- ibm_catalog.json | 13 ++++++++++++- solutions/fully-configurable/variables.tf | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/ibm_catalog.json b/ibm_catalog.json index aa0b08e1..a58ce289 100644 --- a/ibm_catalog.json +++ b/ibm_catalog.json @@ -58,7 +58,18 @@ }, { "key": "prefix", - "required": true + "required": true, + "default_value": "dev", + "random_string": { + "length": 4 + }, + "value_constraints": [ + { + "type": "regex", + "description": "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 ('--'). It should not exceed 16 characters.", + "value": "^$|^__NULL__$|^[a-z](?!.*--)(?:[a-z0-9-]{0,14}[a-z0-9])?$" + } + ] }, { "key": "cbr_zones", diff --git a/solutions/fully-configurable/variables.tf b/solutions/fully-configurable/variables.tf index bf32c599..9ced50a6 100644 --- a/solutions/fully-configurable/variables.tf +++ b/solutions/fully-configurable/variables.tf @@ -11,7 +11,7 @@ variable "ibmcloud_api_key" { variable "prefix" { type = string nullable = true - description = "The prefix to be added to all resources created by this solution. To skip using a prefix, set this value to null or an empty string. The prefix must begin with a lowercase letter and may contain only lowercase letters, digits, and hyphens '-'. It should not exceed 16 characters, must not end with a hyphen('-'), and can not contain consecutive hyphens ('--'). Example: prod-cbr. [Learn more](https://terraform-ibm-modules.github.io/documentation/#/prefix.md)." + description = "The prefix to add to all resources that this solution creates (e.g `prod`, `test`, `dev`). To skip using a prefix, set this value to null or an empty string. [Learn more](https://terraform-ibm-modules.github.io/documentation/#/prefix.md)." validation { # - null and empty string is allowed