Skip to content

Commit c7d20ae

Browse files
feat: Add Project UI regex validation for the DA (#559)
1 parent fdd8462 commit c7d20ae

File tree

3 files changed

+116
-16
lines changed

3 files changed

+116
-16
lines changed

ibm_catalog.json

Lines changed: 112 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,14 @@
7272
},
7373
{
7474
"key": "prefix",
75-
"required": true
75+
"required": true,
76+
"value_constraints": [
77+
{
78+
"type": "regex",
79+
"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.",
80+
"value": "^$|^__NULL__$|^[a-z](?!.*--)(?:[a-z0-9-]{0,14}[a-z0-9])?$"
81+
}
82+
]
7683
},
7784
{
7885
"key": "region",
@@ -122,7 +129,14 @@
122129
},
123130
{
124131
"key": "existing_kms_instance_crn",
125-
"required": true
132+
"required": true,
133+
"value_constraints": [
134+
{
135+
"type": "regex",
136+
"description": "The value provided for 'existing_kms_instance_crn' is not valid.",
137+
"value": "^__NULL__$|^crn:(.*:){3}(kms|hs-crypto):(.*:){2}[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}::$"
138+
}
139+
]
126140
},
127141
{
128142
"key": "kms_endpoint_url",
@@ -143,7 +157,14 @@
143157
"description": "The name of an existing resource group to provision the resources."
144158
},
145159
{
146-
"key": "existing_monitoring_crn"
160+
"key": "existing_monitoring_crn",
161+
"value_constraints": [
162+
{
163+
"type": "regex",
164+
"description": "The value provided for 'existing_monitoring_crn' is not valid.",
165+
"value": "^__NULL__$|^crn:(.*:){3}sysdig-monitor:(.*:){2}[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}::$"
166+
}
167+
]
147168
},
148169
{
149170
"key": "event_notifications_instance_name"
@@ -152,7 +173,14 @@
152173
"key": "event_notifications_resource_tags"
153174
},
154175
{
155-
"key": "existing_kms_root_key_crn"
176+
"key": "existing_kms_root_key_crn",
177+
"value_constraints": [
178+
{
179+
"type": "regex",
180+
"description": "The value provided for 'existing_kms_root_key_crn' is not valid.",
181+
"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-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
182+
}
183+
]
156184
},
157185
{
158186
"key": "event_notifications_key_ring_name"
@@ -170,7 +198,14 @@
170198
"key": "ibmcloud_kms_api_key"
171199
},
172200
{
173-
"key": "existing_cos_instance_crn"
201+
"key": "existing_cos_instance_crn",
202+
"value_constraints": [
203+
{
204+
"type": "regex",
205+
"description": "The value provided for 'existing_cos_instance_crn' is not valid.",
206+
"value": "^crn:(.*:){3}cloud-object-storage:(.*:){2}[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}::$"
207+
}
208+
]
174209
},
175210
{
176211
"key": "cos_bucket_name"
@@ -204,7 +239,14 @@
204239
"key": "cos_bucket_region"
205240
},
206241
{
207-
"key": "existing_secrets_manager_instance_crn"
242+
"key": "existing_secrets_manager_instance_crn",
243+
"value_constraints": [
244+
{
245+
"type": "regex",
246+
"description": "The value provided for 'existing_secrets_manager_instance_crn' is not valid.",
247+
"value": "^__NULL__$|^crn:(.*:){3}secrets-manager:(.*:){2}[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}::$"
248+
}
249+
]
208250
},
209251
{
210252
"key": "skip_event_notifications_secrets_manager_auth_policy"
@@ -222,7 +264,14 @@
222264
"key": "service_credential_names"
223265
},
224266
{
225-
"key": "existing_event_notifications_instance_crn"
267+
"key": "existing_event_notifications_instance_crn",
268+
"value_constraints": [
269+
{
270+
"type": "regex",
271+
"description": "The value provided for 'existing_event_notifications_instance_crn' is not valid.",
272+
"value": "^__NULL__$|^crn:(.*:){3}event-notifications:(.*:){2}[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}::$"
273+
}
274+
]
226275
},
227276
{
228277
"key": "cbr_rules",
@@ -325,7 +374,14 @@
325374
},
326375
{
327376
"key": "prefix",
328-
"required": true
377+
"required": true,
378+
"value_constraints": [
379+
{
380+
"type": "regex",
381+
"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.",
382+
"value": "^$|^__NULL__$|^[a-z](?!.*--)(?:[a-z0-9-]{0,14}[a-z0-9])?$"
383+
}
384+
]
329385
},
330386
{
331387
"key": "region",
@@ -410,7 +466,14 @@
410466
"description": "The name of an existing resource group to provision the resources."
411467
},
412468
{
413-
"key": "existing_monitoring_crn"
469+
"key": "existing_monitoring_crn",
470+
"value_constraints": [
471+
{
472+
"type": "regex",
473+
"description": "The value provided for 'existing_monitoring_crn' is not valid.",
474+
"value": "^__NULL__$|^crn:(.*:){3}sysdig-monitor:(.*:){2}[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}::$"
475+
}
476+
]
414477
},
415478
{
416479
"key": "event_notifications_instance_name"
@@ -439,19 +502,40 @@
439502
"key": "event_notifications_access_tags"
440503
},
441504
{
442-
"key": "existing_event_notifications_instance_crn"
505+
"key": "existing_event_notifications_instance_crn",
506+
"value_constraints": [
507+
{
508+
"type": "regex",
509+
"description": "The value provided for 'existing_event_notifications_instance_crn' is not valid.",
510+
"value": "^__NULL__$|^crn:(.*:){3}event-notifications:(.*:){2}[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}::$"
511+
}
512+
]
443513
},
444514
{
445515
"key": "kms_encryption_enabled"
446516
},
447517
{
448-
"key": "existing_kms_instance_crn"
518+
"key": "existing_kms_instance_crn",
519+
"value_constraints": [
520+
{
521+
"type": "regex",
522+
"description": "The value provided for 'existing_kms_instance_crn' is not valid.",
523+
"value": "^__NULL__$|^crn:(.*:){3}(kms|hs-crypto):(.*:){2}[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}::$"
524+
}
525+
]
449526
},
450527
{
451528
"key": "kms_endpoint_url"
452529
},
453530
{
454-
"key": "existing_kms_root_key_crn"
531+
"key": "existing_kms_root_key_crn",
532+
"value_constraints": [
533+
{
534+
"type": "regex",
535+
"description": "The value provided for 'existing_kms_root_key_crn' is not valid.",
536+
"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-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
537+
}
538+
]
455539
},
456540
{
457541
"key": "kms_endpoint_type",
@@ -504,7 +588,14 @@
504588
"key": "enable_collecting_failed_events"
505589
},
506590
{
507-
"key": "existing_cos_instance_crn"
591+
"key": "existing_cos_instance_crn",
592+
"value_constraints": [
593+
{
594+
"type": "regex",
595+
"description": "The value provided for 'existing_cos_instance_crn' is not valid.",
596+
"value": "^crn:(.*:){3}cloud-object-storage:(.*:){2}[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}::$"
597+
}
598+
]
508599
},
509600
{
510601
"key": "cos_bucket_name"
@@ -545,7 +636,14 @@
545636
]
546637
},
547638
{
548-
"key": "existing_secrets_manager_instance_crn"
639+
"key": "existing_secrets_manager_instance_crn",
640+
"value_constraints": [
641+
{
642+
"type": "regex",
643+
"description": "The value provided for 'existing_secrets_manager_instance_crn' is not valid.",
644+
"value": "^__NULL__$|^crn:(.*:){3}secrets-manager:(.*:){2}[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}::$"
645+
}
646+
]
549647
},
550648
{
551649
"key": "existing_secrets_manager_endpoint_type",

solutions/fully-configurable/variables.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ variable "existing_monitoring_crn" {
3939

4040
variable "prefix" {
4141
type = string
42-
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: en-0435. [Learn more](https://terraform-ibm-modules.github.io/documentation/#/prefix)."
42+
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)."
43+
4344
validation {
4445
condition = var.prefix == null || var.prefix == "" ? true : alltrue([
4546
can(regex("^[a-z][-a-z0-9]*[a-z0-9]$", var.prefix)), length(regexall("--", var.prefix)) == 0

solutions/security-enforced/variables.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ variable "existing_monitoring_crn" {
2929

3030
variable "prefix" {
3131
type = string
32-
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: en-0435. [Learn more](https://terraform-ibm-modules.github.io/documentation/#/prefix)."
32+
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)."
33+
3334
validation {
3435
condition = var.prefix == null || var.prefix == "" ? true : alltrue([
3536
can(regex("^[a-z][-a-z0-9]*[a-z0-9]$", var.prefix)), length(regexall("--", var.prefix)) == 0

0 commit comments

Comments
 (0)