variable "workspace_name_allowed_values" {
description = "Permitted values of terraform workspace"
type = "list"
default = ["dev", "sit", "prod"]
}
resource "null_resource" "is_workspace_name_allowed" {
count = "${contains(var.workspace_name_allowed_values, "${terraform.workspace}") == true ? 0 : 1}"
"ERROR: Invalid terraform workspace name: ${terraform.workspace}" = true
}
Created
October 10, 2019 22:41
-
-
Save john-auld/0b61279bff12d4341c8f859fb211392a to your computer and use it in GitHub Desktop.
Terraform variable validation example
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment