Set up and use the tfe_outputs data source to share state across HCP Terraform workspaces

domain: developer.hashicorp.com/terraform · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. In the producing workspace, ensure outputs are defined in the Terraform configuration; they are automatically available to other workspaces in the same HCP Terraform organization.
  2. In the consuming workspace's Terraform configuration, declare a tfe_outputs data source block with the organization and workspace name of the producing workspace.
  3. Reference specific output values with data.tfe_outputs.<name>.values.<output_name> in the consuming module; the data source reads the current state outputs of the producing workspace.
  4. Ensure the token used by the consuming workspace has read-state permission on the producing workspace; use a team API token with the appropriate permissions rather than a personal token for CI.
  5. Avoid using terraform_remote_state for cross-workspace sharing in HCP Terraform; tfe_outputs is the recommended approach and avoids exposing the full state file to the consuming workspace.
  6. Configure a run trigger from the producing workspace to the consuming workspace so the consumer re-plans automatically when the producer's outputs change.

Known gotchas

Related routes

Configure HCP Terraform run triggers to chain workspace deploys
developer.hashicorp.com/terraform · 6 steps · unrated
Enable HCP Terraform workspace health assessments for drift detection and continuous validation
developer.hashicorp.com/terraform/cloud-docs · 6 steps · unrated
Manage multi-environment Terraform state with Terragrunt remote_state blocks and path_relative_to_include
terragrunt.gruntwork.io · 6 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans