Skip to content

Commit

Permalink
website: document templates
Browse files Browse the repository at this point in the history
While we're here, fix a broken link.
  • Loading branch information
josharian committed May 4, 2015
1 parent 76bcac3 commit 0db2c2d
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
30 changes: 30 additions & 0 deletions website/source/docs/configuration/interpolation.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,33 @@ The supported built-in functions are:
back into a list. This is useful for pushing lists through module
outputs since they currently only support string values.
Example: `split(",", module.amod.server_ids)`

## Templates

Long strings can be managed using templates. Templates are [resources](/docs/configuration/resources.html) defined by a filename and somes variable to use during interpolation. They have a computed `rendered` attribute containing the result.

A template resource looks like:

```
resource "template_file" "example" {
filename = "template.txt"
vars {
hello = "goodnight"
world = "moon"
}
}
output "rendered" {
value = "${template_file.example.rendered}"
}
```

Assuming `template.txt` looks like this:

```
${hello} ${world}!
```

Then the rendered value would be `goodnight moon!`.

You may use any of the built-in functions in your template.
2 changes: 1 addition & 1 deletion website/source/docs/configuration/providers.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ description: |-
# Provider Configuration

Providers are responsible in Terraform for managing the lifecycle
of a [resource](/docs/configuration/resource.html): create,
of a [resource](/docs/configuration/resources.html): create,
read, update, delete.

Every resource in Terraform is mapped to a provider based
Expand Down

0 comments on commit 0db2c2d

Please sign in to comment.