github.com/jmbataller/terraform@v0.6.8-0.20151125192640-b7a12e3a580c/website/source/docs/providers/template/r/file.html.md (about) 1 --- 2 layout: "template" 3 page_title: "Template: template_file" 4 sidebar_current: "docs-template-resource-file" 5 description: |- 6 Renders a template from a file. 7 --- 8 9 # template\_file 10 11 Renders a template from a file. 12 13 ## Example Usage 14 15 ``` 16 resource "template_file" "init" { 17 template = "${file("${path.module}/init.tpl")}" 18 19 vars { 20 consul_address = "${aws_instance.consul.private_ip}" 21 } 22 } 23 24 ``` 25 26 ## Argument Reference 27 28 The following arguments are supported: 29 30 * `template` - (Required) The contents of the template. These can be loaded 31 from a file on disk using the [`file()` interpolation 32 function](/docs/configuration/interpolation.html#file_path_). 33 34 * `vars` - (Optional) Variables for interpolation within the template. 35 36 The following arguments are maintained for backwards compatibility and may be 37 removed in a future version: 38 39 * `filename` - __Deprecated, please use `template` instead_. The filename for 40 the template. Use [path variables](/docs/configuration/interpolation.html#path-variables) to make 41 this path relative to different path roots. 42 43 ## Attributes Reference 44 45 The following attributes are exported: 46 47 * `template` - See Argument Reference above. 48 * `vars` - See Argument Reference above. 49 * `rendered` - The final rendered template. 50 51 ## Template files syntax 52 53 The syntax of the template files is [documented here](/docs/configuration/interpolation.html), under the "Templates" section.