2015-05-26 15:35:19 +02:00
|
|
|
---
|
|
|
|
layout: "terraform"
|
|
|
|
page_title: "Terraform: terraform_remote_state"
|
2016-05-02 01:05:54 +02:00
|
|
|
sidebar_current: "docs-terraform-datasource-remote-state"
|
2015-05-26 15:35:19 +02:00
|
|
|
description: |-
|
|
|
|
Accesses state meta data from a remote backend.
|
|
|
|
---
|
|
|
|
|
|
|
|
# remote\_state
|
|
|
|
|
|
|
|
Retrieves state meta data from a remote backend
|
|
|
|
|
|
|
|
## Example Usage
|
|
|
|
|
|
|
|
```
|
2016-05-02 01:05:54 +02:00
|
|
|
data "terraform_remote_state" "vpc" {
|
2015-05-26 15:35:19 +02:00
|
|
|
backend = "atlas"
|
|
|
|
config {
|
2016-02-03 14:20:35 +01:00
|
|
|
name = "hashicorp/vpc-prod"
|
2015-05-26 15:35:19 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "aws_instance" "foo" {
|
|
|
|
# ...
|
2016-05-02 01:05:54 +02:00
|
|
|
subnet_id = "${data.terraform_remote_state.vpc.output.subnet_id}"
|
2015-05-26 15:35:19 +02:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
## Argument Reference
|
|
|
|
|
|
|
|
The following arguments are supported:
|
|
|
|
|
|
|
|
* `backend` - (Required) The remote backend to use.
|
|
|
|
* `config` - (Optional) The configuration of the remote backend.
|
2016-02-03 14:20:35 +01:00
|
|
|
* Remote state config docs can be found [here](https://www.terraform.io/docs/state/remote/atlas.html)
|
2015-05-26 15:35:19 +02:00
|
|
|
|
|
|
|
## 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.
|