Last active
January 3, 2020 04:55
-
-
Save Dartblack4/5aa5c875f8a7723879f4828bd9a57864 to your computer and use it in GitHub Desktop.
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
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}" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.