From 2da7c9a82343404ac5cc0e917e0d51bc9fe065eb Mon Sep 17 00:00:00 2001 From: Josh Bleecher Snyder Date: Mon, 4 May 2015 11:41:18 -0700 Subject: [PATCH] website: document templates While we're here, fix a broken link. --- .../docs/configuration/interpolation.html.md | 30 +++++++++++++++++++ .../docs/configuration/providers.html.md | 2 +- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/website/source/docs/configuration/interpolation.html.md b/website/source/docs/configuration/interpolation.html.md index 45f45e287..b24c02ce8 100644 --- a/website/source/docs/configuration/interpolation.html.md +++ b/website/source/docs/configuration/interpolation.html.md @@ -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 some variables 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. diff --git a/website/source/docs/configuration/providers.html.md b/website/source/docs/configuration/providers.html.md index 5c14dd845..96b4088f7 100644 --- a/website/source/docs/configuration/providers.html.md +++ b/website/source/docs/configuration/providers.html.md @@ -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