Created
September 9, 2019 20:04
-
-
Save glaracuente/0dcba98553b3022369e243b87209c731 to your computer and use it in GitHub Desktop.
workspace_checker for 0.12, does NOT work with 0.11
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
locals { | |
invalid_workspace = contains(var.valid_workspaces, terraform.workspace) ? null : file( | |
"ERROR: You're running in the ${terraform.workspace} workspace which isn't valid for this project. You can set the workspace name by typing: terraform workspace select <name>. Valid workspaces for this project are: ${join(",", var.valid_workspaces)}", | |
) | |
} | |
variable "valid_workspaces" { | |
description = "List of valid workspaces for this project" | |
type = list(string) | |
} | |
resource "null_resource" "workspace_checker" { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment