diff --git a/website/source/docs/configuration/interpolation.html.md b/website/source/docs/configuration/interpolation.html.md index 21efbd83e..bcabe58ff 100644 --- a/website/source/docs/configuration/interpolation.html.md +++ b/website/source/docs/configuration/interpolation.html.md @@ -178,29 +178,22 @@ A template resource looks like: ``` resource "template_file" "example" { - filename = "template.txt" - vars { - hello = "goodnight" - world = "moon" - } + template = "${hello} ${world}!" + vars { + hello = "goodnight" + world = "moon" + } } output "rendered" { - value = "${template_file.example.rendered}" + value = "${template_file.example.rendered}" } ``` -Assuming `template.txt` looks like this: - -``` -${hello} ${world}! -``` - Then the rendered value would be `goodnight moon!`. You may use any of the built-in functions in your template. - ### Using Templates with Count Here is an example that combines the capabilities of templates with the interpolation @@ -220,8 +213,8 @@ variable "hostnames" { resource "template_file" "web_init" { // here we expand multiple template_files - the same number as we have instances - count = "${var.count}" - filename = "templates/web_init.tpl" + count = "${var.count}" + template = "${file("templates/web_init.tpl")}" vars { // that gives us access to use count.index to do the lookup hostname = "${lookup(var.hostnames, count.index)}"