Added some basic variable validation
This commit is contained in:
parent
352b7a0645
commit
7bd31ccf52
|
@ -97,6 +97,10 @@ variable "type" {
|
||||||
description = "Type of zone to create, valid values are 'public', 'private', 'forwarding', 'peering', 'service-directory'."
|
description = "Type of zone to create, valid values are 'public', 'private', 'forwarding', 'peering', 'service-directory'."
|
||||||
type = string
|
type = string
|
||||||
default = "private"
|
default = "private"
|
||||||
|
validation {
|
||||||
|
condition = contains(["public", "private", "forwarding", "peering", "service-directory"], var.type)
|
||||||
|
error_message = "Zone must be one of 'public', 'private', 'forwarding', 'peering', 'service-directory'."
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "zone_create" {
|
variable "zone_create" {
|
||||||
|
@ -106,3 +110,4 @@ variable "zone_create" {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -88,6 +88,10 @@ variable "storage_class" {
|
||||||
description = "Bucket storage class."
|
description = "Bucket storage class."
|
||||||
type = string
|
type = string
|
||||||
default = "MULTI_REGIONAL"
|
default = "MULTI_REGIONAL"
|
||||||
|
validation {
|
||||||
|
condition = contains(["STANDARD", "MULTI_REGIONAL", "REGIONAL", "NEARLINE", "COLDLINE", "ARCHIVE"], var.storage_class)
|
||||||
|
error_message = "Storage class must be one of STANDARD, MULTI_REGIONAL, REGIONAL, NEARLINE, COLDLINE, ARCHIVE."
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "versioning" {
|
variable "versioning" {
|
||||||
|
|
|
@ -100,6 +100,11 @@ variable "routing_mode" {
|
||||||
description = "The network routing mode (default 'GLOBAL')"
|
description = "The network routing mode (default 'GLOBAL')"
|
||||||
type = string
|
type = string
|
||||||
default = "GLOBAL"
|
default = "GLOBAL"
|
||||||
|
validation {
|
||||||
|
condition = var.routing_mode == "GLOBAL" || var.routing_mode == "REGIONAL"
|
||||||
|
error_message = "Routing type must be GLOBAL or REGIONAL."
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "shared_vpc_host" {
|
variable "shared_vpc_host" {
|
||||||
|
|
|
@ -83,6 +83,10 @@ variable "parent" {
|
||||||
description = "Parent folder or organization in 'folders/folder_id' or 'organizations/org_id' format."
|
description = "Parent folder or organization in 'folders/folder_id' or 'organizations/org_id' format."
|
||||||
type = string
|
type = string
|
||||||
default = null
|
default = null
|
||||||
|
validation {
|
||||||
|
condition = can(regex("(organizations|folders)/[0-9]+", var.parent))
|
||||||
|
error_message = "Parent must be of the form folders/folder_id or organizations/organization_id."
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "policy_boolean" {
|
variable "policy_boolean" {
|
||||||
|
|
Loading…
Reference in New Issue