From b6788479dec40a7c6dafde8932878c4d1bcb9f8a Mon Sep 17 00:00:00 2001 From: John Engelman Date: Tue, 26 May 2015 08:35:19 -0500 Subject: [PATCH] Add Terraform/Remote State documentation to provider/resource section. Issue #2074 --- website/source/assets/stylesheets/_docs.scss | 1 + .../providers/terraform/index.html.markdown | 38 +++++++++++++++++ .../terraform/r/remote_state.html.md | 42 +++++++++++++++++++ website/source/docs/state/remote.html.md | 20 +-------- website/source/layouts/docs.erb | 4 ++ website/source/layouts/terraform.erb | 26 ++++++++++++ 6 files changed, 112 insertions(+), 19 deletions(-) create mode 100644 website/source/docs/providers/terraform/index.html.markdown create mode 100644 website/source/docs/providers/terraform/r/remote_state.html.md create mode 100644 website/source/layouts/terraform.erb diff --git a/website/source/assets/stylesheets/_docs.scss b/website/source/assets/stylesheets/_docs.scss index 0143966b4..9a2a5052e 100755 --- a/website/source/assets/stylesheets/_docs.scss +++ b/website/source/assets/stylesheets/_docs.scss @@ -35,6 +35,7 @@ body.layout-vsphere, 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; diff --git a/website/source/docs/providers/terraform/index.html.markdown b/website/source/docs/providers/terraform/index.html.markdown new file mode 100644 index 000000000..e5ccbff59 --- /dev/null +++ b/website/source/docs/providers/terraform/index.html.markdown @@ -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}" +} +``` diff --git a/website/source/docs/providers/terraform/r/remote_state.html.md b/website/source/docs/providers/terraform/r/remote_state.html.md new file mode 100644 index 000000000..b02ddfee9 --- /dev/null +++ b/website/source/docs/providers/terraform/r/remote_state.html.md @@ -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. diff --git a/website/source/docs/state/remote.html.md b/website/source/docs/state/remote.html.md index 3ab01fa79..40f4e32be 100644 --- a/website/source/docs/state/remote.html.md +++ b/website/source/docs/state/remote.html.md @@ -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 the [terraform_remote_state](/docs/providers/terraform/r/remote_state.html) resource. ## Locking and Teamwork @@ -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. - diff --git a/website/source/layouts/docs.erb b/website/source/layouts/docs.erb index 73c8aad08..5e7ec4c3a 100644 --- a/website/source/layouts/docs.erb +++ b/website/source/layouts/docs.erb @@ -213,6 +213,10 @@ Template + > + Terraform + + > TLS diff --git a/website/source/layouts/terraform.erb b/website/source/layouts/terraform.erb new file mode 100644 index 000000000..c3ff37f8e --- /dev/null +++ b/website/source/layouts/terraform.erb @@ -0,0 +1,26 @@ +<% wrap_layout :inner do %> + <% content_for :sidebar do %> + + <% end %> + + <%= yield %> +<% end %>