Skip to content

Instantly share code, notes, and snippets.

@Dartblack4
Last active January 3, 2020 04:55
Show Gist options
  • Save Dartblack4/5aa5c875f8a7723879f4828bd9a57864 to your computer and use it in GitHub Desktop.
Save Dartblack4/5aa5c875f8a7723879f4828bd9a57864 to your computer and use it in GitHub Desktop.
provider "hcloud" { # Provider designation hetzner
token = "${var.hcloud_token}" # The token for connection to the hetzner API is specified in the terraform.tfvars file
}
# Resource random to generate random characters
resource "random_string" "name" {
length = 6
special = false
upper = false
}
# The designation of the name, which is built from the variable name + environment terraform + result random
locals {
name = "${var.name}-${terraform.env}-${random_string.name.result}"
}
@schnells
Copy link

schnells commented Jan 3, 2020

The terraform.env (line 16) attribute was deprecated in v0.10 and removed in v0.12. The
"state environment" concept was rename to "workspace" in v0.12, and so the
workspace name can now be accessed using the terraform.workspace attribute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment