docs: clarify template_file path information

- change example to use the most commonly necessary path format w/
   `path.module`
 - link to path variable page in description

/cc @KFishner
This commit is contained in:
Paul Hinze 2015-07-31 11:44:07 -05:00
parent 6d0a2df65f
commit 2cea7c7d0c
2 changed files with 6 additions and 4 deletions

View File

@ -57,6 +57,8 @@ For example, `${count.index}` will interpolate the current index
in a multi-count resource. For more information on count, see the in a multi-count resource. For more information on count, see the
resource configuration page. resource configuration page.
<a id="path-variables"></a>
**To reference path information**, the syntax is `path.TYPE`. **To reference path information**, the syntax is `path.TYPE`.
TYPE can be `cwd`, `module`, or `root`. `cwd` will interpolate the TYPE can be `cwd`, `module`, or `root`. `cwd` will interpolate the
cwd. `module` will interpolate the path to the current module. `root` cwd. `module` will interpolate the path to the current module. `root`

View File

@ -14,7 +14,7 @@ Renders a template from a file.
``` ```
resource "template_file" "init" { resource "template_file" "init" {
filename = "init.tpl" filename = "${path.module}/init.tpl"
vars { vars {
consul_address = "${aws_instance.consul.private_ip}" consul_address = "${aws_instance.consul.private_ip}"
@ -27,9 +27,9 @@ resource "template_file" "init" {
The following arguments are supported: The following arguments are supported:
* `filename` - (Required) The filename for the template. Use path variables * `filename` - (Required) The filename for the template. Use [path
(documented in the interpolation section) to specify what the path is variables](/docs/configuration/interpolation.html#path-variables) to make
relative to. this path relative to different path roots.
* `vars` - (Optional) Variables for interpolation within the template. * `vars` - (Optional) Variables for interpolation within the template.