@@ -156,6 +156,24 @@ variable "existing_serviceref_zone" {
156156 {
157157 zone_id = string
158158 }))
159+ validation {
160+ condition = var.existing_serviceref_zone == null || (alltrue ([for zone in var . existing_serviceref_zone : can (regex (" ^[0-9a-fA-F]{32}$" , zone. zone_id ))]))
161+ error_message = " Value should be a valid zone id with 32 alphanumeric characters"
162+ }
163+ validation {
164+ condition = alltrue ([
165+ for key , _ in var . existing_serviceref_zone :
166+ contains ([" cloud-object-storage" , " codeengine" , " containers-kubernetes" ,
167+ " databases-for-cassandra" , " databases-for-elasticsearch" , " databases-for-enterprisedb" ,
168+ " databases-for-etcd" , " databases-for-mongodb" ,
169+ " databases-for-mysql" , " databases-for-postgresql" ,
170+ " databases-for-redis" , " directlink" ,
171+ " iam-groups" , " is" , " messagehub" ,
172+ " messages-for-rabbitmq" , " schematics" , " secrets-manager" , " server-protect" , " user-management" ,
173+ " apprapp" , " compliance" , " event-notifications" , " logdna" , " logdnaat" ], key)
174+ ])
175+ error_message = " Provide a valid service reference"
176+ }
159177 description = " Provide a valid service reference and existing zone id"
160178 default = {}
161179}
@@ -165,6 +183,10 @@ variable "existing_cbr_zone_vpcs" {
165183 {
166184 zone_id = string
167185 })
186+ validation {
187+ condition = var.existing_cbr_zone_vpcs == null || (can (regex (" ^[0-9a-fA-F]{32}$" , var. existing_cbr_zone_vpcs . zone_id )))
188+ error_message = " Value should be a valid zone id with 32 alphanumeric characters"
189+ }
168190 description = " Provide a existing zone id for VPC"
169191 default = null
170192}
0 commit comments