Skip to content

Commit 1b70ba3

Browse files
authored
fix: Relax regex validation of service CRN (cloud_service_by_crn) (#727)
1 parent 2531387 commit 1b70ba3

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

solutions/fully-configurable/variables.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,13 @@ variable "cloud_service_by_crn" {
127127
})
128128
)
129129
default = []
130+
130131
validation {
131132
condition = (
132133
length(var.cloud_service_by_crn) == 0 ? true : alltrue([
133134
for service in var.cloud_service_by_crn : can(
134135
regex(
135-
"^crn:v1:[^:]+:[^:]+:[^:]+:[^:]+:a/[0-9a-f]{32}(:[^:]*)*:{0,2}$",
136+
"^crn:v\\d(?::(?:(?:[^:]*)(?:[^:]|$))?){8}$",
136137
service.crn
137138
)
138139
)

variables.tf

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,20 @@ variable "cloud_service_by_crn" {
138138
]) == 0
139139
error_message = "IBM Cloud Monitoring in Montreal is supported by removing the sysdig-monitor CRN and adding `sysdig-monitor` to the `cloud_services` variable input"
140140
}
141+
142+
validation {
143+
condition = (
144+
length(var.cloud_service_by_crn) == 0 ? true : alltrue([
145+
for service in var.cloud_service_by_crn : can(
146+
regex(
147+
"^crn:v\\d(?::(?:(?:[^:]*)(?:[^:]|$))?){8}$",
148+
service.crn
149+
)
150+
)
151+
])
152+
)
153+
error_message = "The provided environment CRN in the input 'cloud_service_by_crn' in not valid."
154+
}
141155
}
142156

143157
variable "service_endpoints" {

0 commit comments

Comments
 (0)