Skip to content

Commit f94351d

Browse files
fix: added regex validation to the DA for prefix, existing_kms_instance_crn, existing_cluster_kms_key_crn and existing_boot_volume_kms_key_crn inputs (#751)
1 parent cb76a6f commit f94351d

File tree

2 files changed

+25
-10
lines changed

2 files changed

+25
-10
lines changed

ibm_catalog.json

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,12 @@
190190
},
191191
{
192192
"key": "prefix",
193-
"required": true
193+
"required": true,
194+
"value_constraint": {
195+
"type": "regex",
196+
"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",
197+
"value": "^$|^__NULL__$|^[a-z](?!.*--)[a-z0-9-]{0,14}[a-z0-9]$"
198+
}
194199
},
195200
{
196201
"key": "cluster_name",
@@ -655,10 +660,20 @@
655660
"key": "kms_encryption_enabled_cluster"
656661
},
657662
{
658-
"key": "existing_kms_instance_crn"
663+
"key": "existing_kms_instance_crn",
664+
"value_constraint": {
665+
"type": "regex",
666+
"description": "The value provided for 'existing_kms_instance_crn' is not valid.",
667+
"value": "^__NULL__$|^crn:(.*:){3}(kms|hs-crypto):(.*:){2}[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}::$"
668+
}
659669
},
660670
{
661-
"key": "existing_cluster_kms_key_crn"
671+
"key": "existing_cluster_kms_key_crn",
672+
"value_constraint": {
673+
"type": "regex",
674+
"description": "The value provided for 'existing_cluster_kms_key_crn' in not valid.",
675+
"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}$"
676+
}
662677
},
663678
{
664679
"key": "kms_endpoint_type",
@@ -684,7 +699,12 @@
684699
"key": "kms_encryption_enabled_boot_volume"
685700
},
686701
{
687-
"key": "existing_boot_volume_kms_key_crn"
702+
"key": "existing_boot_volume_kms_key_crn",
703+
"value_constraint": {
704+
"type": "regex",
705+
"description": "The value provided for 'existing_boot_volume_kms_key_crn' in not valid.",
706+
"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}$"
707+
}
688708
},
689709
{
690710
"key": "boot_volume_kms_key_name"
@@ -776,7 +796,7 @@
776796
"hidden": true
777797
},
778798
{
779-
"key":"enable_kube_audit"
799+
"key": "enable_kube_audit"
780800
},
781801
{
782802
"key": "audit_deployment_name"

solutions/fully-configurable/variables.tf

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -600,9 +600,4 @@ variable "audit_webhook_listener_image_tag_digest" {
600600
type = string
601601
description = "The tag or digest for the audit webhook listener image to deploy. If changing the value, ensure it is compatible with `audit_webhook_listener_image`."
602602
default = "deaabcb8225e800385413ba420cf3f819d3b0671@sha256:acf123f4dba63534cbc104c6886abedff9d25a22a34ab7b549ede988ed6e7144"
603-
604-
validation {
605-
condition = can(regex("^[a-f0-9]{40}@sha256:[a-f0-9]{64}$", var.audit_webhook_listener_image_tag_digest))
606-
error_message = "The value of the audit webhook listener image version must match the tag and sha256 image digest format"
607-
}
608603
}

0 commit comments

Comments
 (0)