website: In 0.12, terraform_remote_state syntax differs from backend config

This commit is contained in:
Nick Fagerlund 2019-08-28 19:59:39 -07:00 committed by Nick Fagerlund
parent e1fb26de94
commit a038f8c43b
2 changed files with 24 additions and 10 deletions

View File

@ -24,8 +24,12 @@ use interpolations when configuring them.
```hcl
data "terraform_remote_state" "vpc" {
backend = "remote"
config = {
name = "hashicorp/vpc-prod"
organization = "hashicorp"
workspaces = {
name = "vpc-prod"
}
}
}
@ -49,19 +53,26 @@ The following arguments are supported:
* `backend` - (Required) The remote backend to use.
* `workspace` - (Optional) The Terraform workspace to use, if the backend
supports workspaces.
* `config` - (Optional; block) The configuration of the remote backend. The
`config` block can use any arguments that would be valid in the equivalent
`terraform { backend "<TYPE>" { ... } }` block. See
[the documentation of your chosen backend](/docs/backends/types/index.html)
for details.
* `defaults` - (Optional; block) Default values for outputs, in case the state
* `config` - (Optional; object) The configuration of the remote backend.
Although this argument is listed as optional, most backends require
some configuration.
The `config` object can use any arguments that would be valid in the
equivalent `terraform { backend "<TYPE>" { ... } }` block. See
[the documentation of your chosen backend](/docs/backends/types/index.html)
for details.
-> **Note:** If the backend configuration requires a nested block, specify
it here as a normal attribute with an object value. (For example,
`workspaces = { ... }` instead of `workspaces { ... }`.)
* `defaults` - (Optional; object) Default values for outputs, in case the state
file is empty or lacks a required output.
## Attributes Reference
In addition to the above, the following attributes are exported:
* (v0.12+) `outputs` - An object containing every root-level
* (v0.12+) `outputs` - An object containing every root-level
[output](/docs/configuration/outputs.html) in the remote state.
* (<= v0.11) `<OUTPUT NAME>` - Each root-level [output](/docs/configuration/outputs.html)
in the remote state appears as a top level attribute on the data source.

View File

@ -18,10 +18,13 @@ Use the navigation to the left to read about the available data sources.
```hcl
# Shared infrastructure state stored in Atlas
data "terraform_remote_state" "vpc" {
backend = "atlas"
backend = "remote"
config {
name = "hashicorp/vpc-prod"
organization = "hashicorp"
workspaces = {
name = "vpc-prod"
}
}
}