github.com/minamijoyo/terraform@v0.7.8-0.20161029001309-18b3736ba44b/website/source/docs/providers/template/d/file.html.md (about) 1 --- 2 layout: "template" 3 page_title: "Template: template_file" 4 sidebar_current: "docs-template-datasource-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 data "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. Note 35 that variables must all be primitives. Direct references to lists or maps 36 will cause a validation error. 37 38 The following arguments are maintained for backwards compatibility and may be 39 removed in a future version: 40 41 * `filename` - _Deprecated, please use `template` instead_. The filename for 42 the template. Use [path variables](/docs/configuration/interpolation.html#path-variables) to make 43 this path relative to different path roots. 44 45 ## Attributes Reference 46 47 The following attributes are exported: 48 49 * `template` - See Argument Reference above. 50 * `vars` - See Argument Reference above. 51 * `rendered` - The final rendered template. 52 53 ## Template files syntax 54 55 The syntax of the template files is [documented here](/docs/configuration/interpolation.html), under the "Templates" section.