Skip to content

Commit

Permalink
Add Terraform/Remote State documentation to provider/resource section.
Browse files Browse the repository at this point in the history
Issue #2074
  • Loading branch information
johnrengelman committed Oct 8, 2015
1 parent aaa922c commit 0f551d6
Show file tree
Hide file tree
Showing 6 changed files with 112 additions and 19 deletions.
1 change: 1 addition & 0 deletions website/source/assets/stylesheets/_docs.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ body.layout-template,
body.layout-docs,
body.layout-downloads,
body.layout-inner,
body.layout-terraform,
body.layout-intro{
background: $light-black image-url('sidebar-wire.png') left 62px no-repeat;

Expand Down
38 changes: 38 additions & 0 deletions website/source/docs/providers/terraform/index.html.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
layout: "terraform"
page_title: "Provider: Terraform"
sidebar_current: "docs-terraform-index"
description: |-
The Terraform provider is used to access meta data from shared infrastructure.
---

# Terraform Provider

The terraform provider exposes resources to access state meta data
for Terraform outputs from shared infrastructure.

The terraform provider is what we call a _logical provider_. This has no
impact on how it behaves, but conceptually it is important to understand.
The terraform provider doesn't manage any _physical_ resources; it isn't
creating servers, writing files, etc. It is used to access the outputs
of other Terraform states to be used as inputs for resources.
Examples will explain this best.

Use the navigation to the left to read about the available resources.

## Example Usage

```
# Shared infrastructure state stored in Atlas
resource "terraform_remote_state" "vpc" {
backend = "atlas"
config {
path = "hashicorp/vpc-prod"
}
}
resource "aws_instance" "foo" {
# ...
subnet_id = "${terraform_remote_state.vpc.output.subnet_id}"
}
```
42 changes: 42 additions & 0 deletions website/source/docs/providers/terraform/r/remote_state.html.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
layout: "terraform"
page_title: "Terraform: terraform_remote_state"
sidebar_current: "docs-terraform-resource-remote-state"
description: |-
Accesses state meta data from a remote backend.
---

# remote\_state

Retrieves state meta data from a remote backend

## Example Usage

```
resource "terraform_remote_state" "vpc" {
backend = "atlas"
config {
path = "hashicorp/vpc-prod"
}
}
resource "aws_instance" "foo" {
# ...
subnet_id = "${terraform_remote_state.vpc.output.subnet_id}"
}
```

## Argument Reference

The following arguments are supported:

* `backend` - (Required) The remote backend to use.
* `config` - (Optional) The configuration of the remote backend.

## Attributes Reference

The following attributes are exported:

* `backend` - See Argument Reference above.
* `config` - See Argument Reference above.
* `output` - The values of the configured `outputs` for the root module referenced by the remote state.
20 changes: 1 addition & 19 deletions website/source/docs/state/remote.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,24 +41,7 @@ teams to run their own infrastructure. As a more specific example with AWS:
you can expose things such as VPC IDs, subnets, NAT instance IDs, etc. through
remote state and have other Terraform states consume that.

An example is shown below:

```
resource "terraform_remote_state" "vpc" {
backend = "atlas"
config {
name = "hashicorp/vpc-prod"
}
}
resource "aws_instance" "foo" {
# ...
subnet_id = "${terraform_remote_state.vpc.output.subnet_id}"
}
```

This makes teamwork and componentization of infrastructure frictionless
within your infrastructure.
For example usage see refer to the [terraform_remote_state](/docs/providers/terraform/r/remote_state.html) resource.

## Locking and Teamwork

Expand All @@ -73,4 +56,3 @@ locking for you.
In the future, we'd like to extend the remote state system to allow some
minimal locking functionality, but it is a difficult problem without a
central system that we currently aren't focused on solving.

4 changes: 4 additions & 0 deletions website/source/layouts/docs.erb
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,10 @@
<li<%= sidebar_current("docs-providers-template") %>>
<a href="/docs/providers/template/index.html">Template</a>
</li>

<li<%= sidebar_current("docs-providers-terraform") %>>
<a href="/docs/providers/terraform/index.html">Terraform</a>
</li>
</ul>
</li>

Expand Down
26 changes: 26 additions & 0 deletions website/source/layouts/terraform.erb
Original file line number Diff line number Diff line change
@@ -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-terraform-index") %>>
<a href="/docs/providers/terraform/index.html">Terraform Provider</a>
</li>

<li<%= sidebar_current(/^docs-terraform-resource/) %>>
<a href="#">Resources</a>
<ul class="nav nav-visible">
<li<%= sidebar_current("docs-terraform-resource-remote-state") %>>
<a href="/docs/providers/terraform/r/remote_state.html">terraform_remote_state</a>
</li>
</ul>
</li>
</ul>
</div>
<% end %>
<%= yield %>
<% end %>

0 comments on commit 0f551d6

Please sign in to comment.