remote state
Reading another configuration's output values from its state, using the terraform_remote_state data source.
In more detail
It lets one configuration use values another publishes, such as a network identifier. It requires read access to the other state, which also exposes every secret in it, so many teams prefer to share values through a dedicated store instead.
Related terms
- output value — A named value a configuration publishes after apply, declared in an output block, like the return value of a function.
- Terraform state — Terraform's record, usually a JSON file called terraform.tfstate, mapping each resource in the configuration to the real object it created.
- data source — A data block that asks a provider to look up an existing object and return its details, without Terraform creating or owning it.
- Terraform backend — The setting that decides where Terraform stores state and how it locks it, from a local file to shared cloud storage.
Related guides
Taught in
- Return Values: Outputs And Locals — Infrastructure as Code with Terraform
- Configuring A Remote Backend — Infrastructure as Code with Terraform
- Input Variables, Outputs, And Which Value Wins — HashiCorp Terraform Associate (004) Exam Prep
- Remote State With The Backend Block — HashiCorp Terraform Associate (004) Exam Prep
- Inspecting And Repairing State From The CLI — HashiCorp Terraform Associate (004) Exam Prep
- The Full Mock: Sixty Minutes, Eight Areas, One Plan For The Last Week — HashiCorp Terraform Associate (004) Exam Prep