website: document templating as a provider

This commit is contained in:
Mitchell Hashimoto 2015-05-07 18:20:05 -07:00
parent c9e0ada075
commit f1ae920aa9
5 changed files with 115 additions and 0 deletions

View File

@ -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,

View File

@ -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}"
}
```

View File

@ -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.

View File

@ -168,6 +168,10 @@
<li<%= sidebar_current("docs-providers-openstack") %>>
<a href="/docs/providers/openstack/index.html">OpenStack</a>
</li>
<li<%= sidebar_current("docs-providers-template") %>>
<a href="/docs/providers/template/index.html">Template</a>
</li>
</ul>
</li>

View File

@ -0,0 +1,26 @@
<% wrap_layout :inner do %>
<% content_for :sidebar do %>
<div class="docs-sidebar hidden-print affix-top" role="complementary">
<ul class="nav docs-sidenav">
<li<%= sidebar_current("docs-home") %>>
<a href="/docs/providers/index.html">&laquo; Documentation Home</a>
</li>
<li<%= sidebar_current("docs-template-index") %>>
<a href="/docs/providers/template/index.html">Template Provider</a>
</li>
<li<%= sidebar_current("docs-template-resource") %>>
<a href="#">Resources</a>
<ul class="nav nav-visible">
<li<%= sidebar_current("docs-template-resource-file") %>>
<a href="/docs/providers/template/r/file.html">template_file</a>
</li>
</ul>
</li>
</ul>
</div>
<% end %>
<%= yield %>
<% end %>