mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
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:
parent
6d0a2df65f
commit
2cea7c7d0c
@ -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`
|
||||||
|
@ -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.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user