Skip to content

Commit ed7dd3b

Browse files
feat: added input validation for the service_crn input (#30)
1 parent 93b4e9a commit ed7dd3b

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

ibm_catalog.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,14 @@
201201
},
202202
{
203203
"key": "service_crn",
204-
"required": true
204+
"required": true,
205+
"value_constraints": [
206+
{
207+
"type": "regex",
208+
"description": "The value provided for 'service_crn' is not valid.",
209+
"value": "^crn:v\\d:(.*:){2}service:global:::endpoint:[A-Za-z0-9.-]+$"
210+
}
211+
]
205212
},
206213
{
207214
"key": "endpoint_type",

solutions/vpe-object/variables.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,12 @@ variable "fully_qualified_domain_names" {
7373
variable "service_crn" {
7474
type = string
7575
description = "CRN of the service to map on VPE entry and on VPE gateway."
76+
77+
validation {
78+
condition = anytrue([
79+
can(regex("^crn:v\\d:(.*:){2}service:global:::endpoint:[A-Za-z0-9.-]+$", var.service_crn)),
80+
var.service_crn == null,
81+
])
82+
error_message = "The value provided for 'service_crn' is not valid."
83+
}
7684
}

0 commit comments

Comments
 (0)