File tree Expand file tree Collapse file tree
website/source/docs/configuration Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -178,29 +178,22 @@ A template resource looks like:
178178
179179```
180180resource "template_file" "example" {
181- filename = "template.txt "
182- vars {
183- hello = "goodnight"
184- world = "moon"
185- }
181+ template = "${hello} ${world}! "
182+ vars {
183+ hello = "goodnight"
184+ world = "moon"
185+ }
186186}
187187
188188output "rendered" {
189- value = "${template_file.example.rendered}"
189+ value = "${template_file.example.rendered}"
190190}
191191```
192192
193- Assuming ` template.txt ` looks like this:
194-
195- ```
196- ${hello} ${world}!
197- ```
198-
199193Then the rendered value would be ` goodnight moon! ` .
200194
201195You may use any of the built-in functions in your template.
202196
203-
204197### Using Templates with Count
205198
206199Here is an example that combines the capabilities of templates with the interpolation
@@ -220,8 +213,8 @@ variable "hostnames" {
220213
221214resource "template_file" "web_init" {
222215 // here we expand multiple template_files - the same number as we have instances
223- count = "${var.count}"
224- filename = "templates/web_init.tpl"
216+ count = "${var.count}"
217+ template = "${file(" templates/web_init.tpl")} "
225218 vars {
226219 // that gives us access to use count.index to do the lookup
227220 hostname = "${lookup(var.hostnames, count.index)}"
You can’t perform that action at this time.
0 commit comments