Skip to content

Instantly share code, notes, and snippets.

@vancluever
Created April 15, 2017 17:23
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 vancluever/22ba79c5594f70c93c04d790ee126039 to your computer and use it in GitHub Desktop.
Save vancluever/22ba79c5594f70c93c04d790ee126039 to your computer and use it in GitHub Desktop.
Names module (Terraform v0.9.x and higher)
variable "endpoint_name" {
type = "string"
}
variable "domains" {
type = "map"
default = {
"production" = "foobar.local"
"staging" = "dev.foobar.local"
}
}
output "endpoint_name" {
value = "${var.endpoint_name}.${split("_", terraform.env)[0]}.${var.domains[element(split("_", terraform.env), 0)]}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment