diff --git a/website/source/assets/stylesheets/_docs.scss b/website/source/assets/stylesheets/_docs.scss index a2c9a55908..48a92b0a77 100755 --- a/website/source/assets/stylesheets/_docs.scss +++ b/website/source/assets/stylesheets/_docs.scss @@ -17,6 +17,7 @@ body.layout-google, body.layout-heroku, body.layout-mailgun, body.layout-openstack, +body.layout-template, body.layout-digitalocean, body.layout-aws, body.layout-docs, diff --git a/website/source/docs/providers/template/index.html.markdown b/website/source/docs/providers/template/index.html.markdown new file mode 100644 index 0000000000..3d6bc78eec --- /dev/null +++ b/website/source/docs/providers/template/index.html.markdown @@ -0,0 +1,41 @@ +--- +layout: "template" +page_title: "Provider: Template" +sidebar_current: "docs-template-index" +description: |- + The Template provider is used to template strings for other Terraform resources. +--- + +# Template Provider + +The template provider exposes resources to use templates to generate +strings for other Terraform resources or outputs. + +The template provider is what we call a _logical provider_. This has no +impact on how it behaves, but conceptually it is important to understand. +The template provider doesn't manage any _physical_ resources; it isn't +creating servers, writing files, etc. It is used to generate attributes that +can be used for interpolation for other resources. Examples will explain +this best. + +Use the navigation to the left to read about the available resources. + +## Example Usage + +``` +# Template for initial configuration bash script +resource "template_file" "init" { + filename = "init.tpl" + + vars { + consul_address = "${aws_instance.consul.private_ip}" + } +} + +# Create a web server +resource "aws_instance" "web" { + # ... + + user_data = "${template_file.init.rendered}" +} +``` diff --git a/website/source/docs/providers/template/r/file.html.md b/website/source/docs/providers/template/r/file.html.md new file mode 100644 index 0000000000..a2e176f38d --- /dev/null +++ b/website/source/docs/providers/template/r/file.html.md @@ -0,0 +1,43 @@ +--- +layout: "template" +page_title: "Template: template_file" +sidebar_current: "docs-template-resource-file" +description: |- + Renders a template from a file. +--- + +# template\_file + +Renders a template from a file. + +## Example Usage + +``` +resource "template_file" "init" { + filename = "init.tpl" + + vars { + consul_address = "${aws_instance.consul.private_ip}" + } +} + +``` + +## Argument Reference + +The following arguments are supported: + +* `filename` - (Required) The filename for the template. Use path variables + (documented in the interpolation section) to specify what the path is + relative to. + +* `vars` - (Optional) Variables for interpolation within the template. + +## Attributes Reference + +The following attributes are exported: + +* `filename` - See Argument Reference above. +* `vars` - See Argument Reference above. +* `rendered` - The final rendered template. + diff --git a/website/source/layouts/docs.erb b/website/source/layouts/docs.erb index b7af63fc22..493dc68161 100644 --- a/website/source/layouts/docs.erb +++ b/website/source/layouts/docs.erb @@ -168,6 +168,10 @@ > OpenStack + + > + Template + diff --git a/website/source/layouts/template.erb b/website/source/layouts/template.erb new file mode 100644 index 0000000000..05c2a4b26b --- /dev/null +++ b/website/source/layouts/template.erb @@ -0,0 +1,26 @@ +<% wrap_layout :inner do %> + <% content_for :sidebar do %> + + <% end %> + + <%= yield %> +<% end %>