From 86c25e18d940fdb622952658bf280069d4ff735b Mon Sep 17 00:00:00 2001 From: Arya Girish K Date: Wed, 15 Oct 2025 14:04:37 +0530 Subject: [PATCH 1/2] feat: Add UI regex validation --- examples/default/README.md | 2 +- examples/private/README.md | 2 +- ibm_catalog.json | 18 ++++++++++++++++-- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/examples/default/README.md b/examples/default/README.md index e9579c3..80c1d49 100644 --- a/examples/default/README.md +++ b/examples/default/README.md @@ -5,6 +5,6 @@ This example uses the IBM Cloud terraform provider to: - Create a new resource group if one is not passed in. - Create a new secrets manager if one is not passed in. - Create a new secrets manager group and private secret engine if existing secrets manager is not passed in. - - Create a new private certifcate inside a secrets manager. + - Create a new private certificate inside a secrets manager. diff --git a/examples/private/README.md b/examples/private/README.md index 619a4a8..80e9545 100644 --- a/examples/private/README.md +++ b/examples/private/README.md @@ -5,6 +5,6 @@ This example uses the IBM Cloud terraform provider to: - Create a new resource group if one is not passed in. - Create a new secrets manager if one is not passed in. - Create a new secrets manager group and private secret engine if existing secrets manager is not passed in. - - Create a new private certifcate inside a secrets manager. + - Create a new private certificate inside a secrets manager. diff --git a/ibm_catalog.json b/ibm_catalog.json index 892c41f..de638cf 100644 --- a/ibm_catalog.json +++ b/ibm_catalog.json @@ -74,11 +74,25 @@ }, { "key": "existing_secrets_manager_crn", - "required": true + "required": true, + "value_constraints": [ + { + "type": "regex", + "description": "The value provided for 'existing_secrets_manager_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": "prefix", - "required": true + "required": true, + "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": "secrets_manager_region", From 5cacb3fe45ab8770840787c10319943155152384 Mon Sep 17 00:00:00 2001 From: Arya Girish K Date: Wed, 15 Oct 2025 15:02:30 +0530 Subject: [PATCH 2/2] feat: Added regex for some more variables --- ibm_catalog.json | 63 ++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 56 insertions(+), 7 deletions(-) diff --git a/ibm_catalog.json b/ibm_catalog.json index de638cf..69e0895 100644 --- a/ibm_catalog.json +++ b/ibm_catalog.json @@ -180,24 +180,66 @@ }, { "key": "cert_name", - "required": true + "required": true, + "value_constraints": [ + { + "type": "regex", + "description": "cert_name must be 2 to 256 chars, start and end with alphanumeric or underscore, and only contain word characters, dots, or dashes.", + "value": "^\\w[\\w\\-.]{0,254}\\w$" + } + ] }, { - "key": "cert_description" + "key": "cert_description", + "value_constraints": [ + { + "type": "regex", + "description": "The value provided for 'cert_description' is not valid.", + "value": "^(?:$|__NULL__|.{1,1024})$" + } + ] }, { - "key": "cert_secrets_group_id" + "key": "cert_secrets_group_id", + "value_constraints": [ + { + "type": "regex", + "description": "The value provided for 'cert_secrets_group_id' is not valid.", + "value": "^$|^__NULL__$|^(?:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|default)$" + } + ] }, { "key": "cert_template", - "required": true + "required": true, + "value_constraints": [ + { + "type": "regex", + "description": "The value provided for 'cert_template' is not valid.", + "value": "^(?:$|__NULL__|(?=.{2,128}$)[A-Za-z0-9][A-Za-z0-9]*(?:_?-?\\.?[A-Za-z0-9]+)*)$" + } + ] }, { - "key": "cert_csr" + "key": "cert_csr", + "value_constraints": [ + { + "type": "regex", + "description": "The value provided for 'cert_csr' is not valid.", + "value": "^__NULL__$|^(-{5}BEGIN.+?-{5}[\\s\\S]+-{5}END.+?-{5})$" + } + ] }, { "key": "cert_common_name", - "required": true + "required": true, + "value_constraints": [ + { + "type": "regex", + "description": "The value provided for 'cert_common_name' is not valid.", + "value": "^__NULL__$|^(?=.{4,128}$).+$" + } + ] }, { "key": "cert_alt_names" @@ -260,7 +302,14 @@ ] }, { - "key": "cert_ttl" + "key": "cert_ttl", + "value_constraints": [ + { + "type": "regex", + "description": "The value provided for 'cert_ttl' is not valid.", + "value": "^__NULL__$|^[0-9]+[s,m,h,d]{0,1}$" + } + ] }, { "key": "cert_other_sans"