Skip to content

Instantly share code, notes, and snippets.

@phinze
Created September 23, 2019 19:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phinze/adb9ee8378c0be3d6b7680afafab99d0 to your computer and use it in GitHub Desktop.
Save phinze/adb9ee8378c0be3d6b7680afafab99d0 to your computer and use it in GitHub Desktop.
Untested sketch of a workaround for terraform.workspace not resolving in Terraform Cloud.
variable "org" {}
data "tfe_workspace_ids" "all" {
names = ["*"]
organization = var.org
}
resource "tfe_variable" "workspace_name" {
for_each = tfe_workspace_ids.all.*.id
workspace = this.key
key = "workspace_name"
value = split("/", this.key)[1]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment