From c7e997296bf7e97aa2a0beb76ab759d72f70ea02 Mon Sep 17 00:00:00 2001 From: Arya Girish K Date: Fri, 24 Oct 2025 12:17:14 +0530 Subject: [PATCH 1/3] feat: Add UI regex-validation --- ibm_catalog.json | 134 +++++++++++++++++++--- solutions/fully-configurable/variables.tf | 2 +- solutions/security-enforced/variables.tf | 2 +- 3 files changed, 122 insertions(+), 16 deletions(-) diff --git a/ibm_catalog.json b/ibm_catalog.json index cfbd827..227397d 100644 --- a/ibm_catalog.json +++ b/ibm_catalog.json @@ -146,7 +146,18 @@ "description": "The name of an existing resource group to provision the resources." }, { - "key": "prefix" + "key": "prefix", + "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": "region", @@ -324,7 +335,14 @@ "key": "admin_pass" }, { - "key": "existing_secrets_manager_instance_crn" + "key": "existing_secrets_manager_instance_crn", + "value_constraints": [ + { + "type": "regex", + "description": "The value provided for 'existing_secrets_manager_instance_crn' is not valid.", + "value": "^__NULL__$|^crn:(.*:){3}secrets-manager:(.*:){2}[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}::$" + } + ] }, { "key": "existing_secrets_manager_endpoint_type", @@ -368,10 +386,24 @@ "key": "kms_encryption_enabled" }, { - "key": "existing_kms_instance_crn" + "key": "existing_kms_instance_crn", + "value_constraints": [ + { + "type": "regex", + "description": "The value provided for 'existing_kms_instance_crn' is not valid.", + "value": "^__NULL__$|^crn:(.*:){3}(kms|hs-crypto):(.*:){2}[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}::$" + } + ] }, { - "key": "existing_kms_key_crn" + "key": "existing_kms_key_crn", + "value_constraints": [ + { + "type": "regex", + "description": "The value provided for 'existing_kms_key_crn' is not valid.", + "value": "^__NULL__$|^crn:(.*:){3}(kms|hs-crypto):(.*:){2}[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}:key:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$" + } + ] }, { "key": "kms_endpoint_type", @@ -394,10 +426,24 @@ "key": "key_name" }, { - "key": "backup_crn" + "key": "backup_crn", + "value_constraints": [ + { + "type": "regex", + "description": "The value provided for 'backup_crn' is not valid.", + "value": "^__NULL__$|^crn:.*:backup:" + } + ] }, { - "key": "existing_backup_kms_key_crn" + "key": "existing_backup_kms_key_crn", + "value_constraints": [ + { + "type": "regex", + "description": "The value provided for 'existing_backup_kms_key_crn' is not valid.", + "value": "^__NULL__$|^crn:(.*:){3}(kms|hs-crypto):(.*:){2}[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}:key:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$" + } + ] }, { "key": "use_default_backup_encryption_key" @@ -406,7 +452,14 @@ "key": "skip_mysql_kms_auth_policy" }, { - "key": "existing_mysql_instance_crn" + "key": "existing_mysql_instance_crn", + "value_constraints": [ + { + "type": "regex", + "description": "The value provided for 'existing_mysql_instance_crn' is not valid.", + "value": "^__NULL__$|^crn:(.*:){3}databases-for-mysql:(.*:){2}[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}::$" + } + ] }, { "key": "remote_leader_crn" @@ -495,7 +548,18 @@ "description": "The name of an existing resource group to provision the resources." }, { - "key": "prefix" + "key": "prefix", + "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": "region", @@ -653,7 +717,14 @@ "key": "admin_pass" }, { - "key": "existing_secrets_manager_instance_crn" + "key": "existing_secrets_manager_instance_crn", + "value_constraints": [ + { + "type": "regex", + "description": "The value provided for 'existing_secrets_manager_instance_crn' is not valid.", + "value": "^__NULL__$|^crn:(.*:){3}secrets-manager:(.*:){2}[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}::$" + } + ] }, { "key": "skip_mysql_secrets_manager_auth_policy" @@ -681,10 +752,24 @@ }, { "key": "existing_kms_instance_crn", - "required": true + "required": true, + "value_constraints": [ + { + "type": "regex", + "description": "The value provided for 'existing_kms_instance_crn' is not valid.", + "value": "^__NULL__$|^crn:(.*:){3}(kms|hs-crypto):(.*:){2}[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}::$" + } + ] }, { - "key": "existing_kms_key_crn" + "key": "existing_kms_key_crn", + "value_constraints": [ + { + "type": "regex", + "description": "The value provided for 'existing_kms_key_crn' is not valid.", + "value": "^__NULL__$|^crn:(.*:){3}(kms|hs-crypto):(.*:){2}[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}:key:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$" + } + ] }, { "key": "key_ring_name" @@ -693,16 +778,37 @@ "key": "key_name" }, { - "key": "backup_crn" + "key": "backup_crn", + "value_constraints": [ + { + "type": "regex", + "description": "The value provided for 'backup_crn' is not valid.", + "value": "^__NULL__$|^crn:.*:backup:" + } + ] }, { - "key": "existing_backup_kms_key_crn" + "key": "existing_backup_kms_key_crn", + "value_constraints": [ + { + "type": "regex", + "description": "The value provided for 'existing_backup_kms_key_crn' is not valid.", + "value": "^__NULL__$|^crn:(.*:){3}(kms|hs-crypto):(.*:){2}[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}:key:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$" + } + ] }, { "key": "skip_mysql_kms_auth_policy" }, { - "key": "existing_mysql_instance_crn" + "key": "existing_mysql_instance_crn", + "value_constraints": [ + { + "type": "regex", + "description": "The value provided for 'existing_mysql_instance_crn' is not valid.", + "value": "^__NULL__$|^crn:(.*:){3}databases-for-mysql:(.*:){2}[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}::$" + } + ] }, { "key": "remote_leader_crn" diff --git a/solutions/fully-configurable/variables.tf b/solutions/fully-configurable/variables.tf index db9093d..14b277e 100644 --- a/solutions/fully-configurable/variables.tf +++ b/solutions/fully-configurable/variables.tf @@ -17,7 +17,7 @@ variable "existing_resource_group_name" { 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-0205-cos. [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 diff --git a/solutions/security-enforced/variables.tf b/solutions/security-enforced/variables.tf index edcfb56..dd3311c 100644 --- a/solutions/security-enforced/variables.tf +++ b/solutions/security-enforced/variables.tf @@ -17,7 +17,7 @@ variable "existing_resource_group_name" { 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-0205-cos. [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 From ea6840568cb332e5626438b9826632706413c84b Mon Sep 17 00:00:00 2001 From: Arya Girish K Date: Fri, 24 Oct 2025 13:35:16 +0530 Subject: [PATCH 2/3] feat: Added regex validation for remote_leader_crn --- ibm_catalog.json | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ibm_catalog.json b/ibm_catalog.json index 227397d..4a6a3f4 100644 --- a/ibm_catalog.json +++ b/ibm_catalog.json @@ -462,7 +462,14 @@ ] }, { - "key": "remote_leader_crn" + "key": "remote_leader_crn", + "value_constraints": [ + { + "type": "regex", + "description": "The value provided for 'remote_leader_crn' is not valid.", + "value": "^__NULL__$|^crn:(.*:){3}databases-for-mysql:(.*:){2}[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}::$" + } + ] } ], "terraform_version": "1.10.5" From 64e3846cab453b3015e0a3b8263acdba0ef7180a Mon Sep 17 00:00:00 2001 From: Arya Girish K Date: Fri, 24 Oct 2025 13:38:36 +0530 Subject: [PATCH 3/3] feat: updated validation --- ibm_catalog.json | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ibm_catalog.json b/ibm_catalog.json index 4a6a3f4..52ccbc2 100644 --- a/ibm_catalog.json +++ b/ibm_catalog.json @@ -818,7 +818,14 @@ ] }, { - "key": "remote_leader_crn" + "key": "remote_leader_crn", + "value_constraints": [ + { + "type": "regex", + "description": "The value provided for 'remote_leader_crn' is not valid.", + "value": "^__NULL__$|^crn:(.*:){3}databases-for-mysql:(.*:){2}[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}::$" + } + ] } ], "terraform_version": "1.10.5"