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 ```hcl
data "terraform_remote_state" "vpc" { data "terraform_remote_state" "vpc" {
backend = "remote" backend = "remote"
config = { 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. * `backend` - (Required) The remote backend to use.
* `workspace` - (Optional) The Terraform workspace to use, if the backend * `workspace` - (Optional) The Terraform workspace to use, if the backend
supports workspaces. supports workspaces.
* `config` - (Optional; block) The configuration of the remote backend. The * `config` - (Optional; object) The configuration of the remote backend.
`config` block can use any arguments that would be valid in the equivalent Although this argument is listed as optional, most backends require
`terraform { backend "<TYPE>" { ... } }` block. See some configuration.
[the documentation of your chosen backend](/docs/backends/types/index.html)
for details. The `config` object can use any arguments that would be valid in the
* `defaults` - (Optional; block) Default values for outputs, in case the state 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. file is empty or lacks a required output.
## Attributes Reference ## Attributes Reference
In addition to the above, the following attributes are exported: 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. [output](/docs/configuration/outputs.html) in the remote state.
* (<= v0.11) `<OUTPUT NAME>` - Each root-level [output](/docs/configuration/outputs.html) * (<= 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. 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 ```hcl
# Shared infrastructure state stored in Atlas # Shared infrastructure state stored in Atlas
data "terraform_remote_state" "vpc" { data "terraform_remote_state" "vpc" {
backend = "atlas" backend = "remote"
config { config {
name = "hashicorp/vpc-prod" organization = "hashicorp"
workspaces = {
name = "vpc-prod"
}
} }
} }