Created
December 16, 2015 20:43
-
-
Save phinze/405c5ce109d2a7475844 to your computer and use it in GitHub Desktop.
take a string like "a b c" and turn that in to "a", "b", "c" in the template
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
variable "input" { | |
default = "a b c" | |
} | |
resource "template_file" "json" { | |
template = "{ \"somekey\": [${list}] }" | |
vars { | |
list = "${join(", ", formatlist("\\"%s\\"", split(" ", var.input)))}" | |
} | |
} | |
output "rendered" { | |
value = "${template_file.json.rendered}" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment