The WORKSPACE_NAME is unique per organization.
Further reading
Next steps
- Allow the reading environment’s project to access the state
- Pass values through environment outputs instead of reading the state directly
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Use the terraform_remote_state data source to read outputs from env zero remote backend state, sharing VPC IDs and endpoints across Terraform stacks.
data "terraform_remote_state" "example" {
backend = "remote"
config = {
hostname = "backend.api.env0.com"
organization = "[ORGANIZATION_ID]"
workspaces = {
name = "[WORKSPACE_NAME]"
}
}
}
provider "aws" {
region = "us-west-2"
}
data "terraform_remote_state" "vpc" {
backend = "remote"
config = {
hostname = "backend.api.env0.com"
organization = "aaaaaaaa-bbbb-cccc-dddd-8f43fe49db92"
workspaces = {
name = "acme-fitness-agent-vpc"
}
}
}
output "vpc_id" {
value = data.terraform_remote_state.vpc.outputs.vpc_id
}
Was this page helpful?