Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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