---
updatedAt: 2026-03-30T16:12:59.000Z
agentTools:
  projectIndex: https://docs.scalr.io/llms.txt
---

# Sharing Outputs

<Callout icon="📘" theme="info">
  Note: Outputs can also be shared using the Scalr provider datasource `scalr_ouputs`. See more <Anchor label="here" target="_blank" href="https://docs.scalr.io/docs/provider_datasource_scalr_outputs">here</Anchor>.
</Callout>

It is common practice to reference outputs from other workspaces so that a Terraform configuration can make use of resources that have been deployed in another workspace. This is done using the `terraform_remote_state` data source as shown in this example. When using the datasource, it will only read outputs, not the entire state file.

```javascript main.tf
data "terraform_remote_state" "state-1" {
  backend = "remote"

  config = {
    hostname = "<host>"
    organization = "<env_id>"
    workspaces = {
      name = "<workspace name>"
    }
  }
}
```

In Scalr,  a workspace can reference the outputs of any other workspace in any environment if `SCALR_RUNNER_ROLE=runner-account-access` has been set as a shell variable at the **account scope**. Alternatively, if `SCALR_RUNNER_ROLE ` is not set at the account scope, then workspaces will only have access to the remote state files within the same environment.

## Sharing Within an Environment

Scalr workspaces have the option to limit which workspaces can access the outputs. Workspace owners can allow the following sharing options:

* All workspaces in an environment
* No workspaces (only accessed by the current workspace)
* Some workspaces

When some workspace is selected, users will be prompted to select the workspaces that output can be shared with:

<Image align="center" src="https://files.readme.io/0de3a841e51a2f7f2f069e384ab067331e36dd3d2abec18b8fbfb08a254aac00-Screenshot_2025-01-30_at_10.16.17_AM.png" />

If the setting is updated to "No workspaces" or "Some workspaces", the output will not be able to be shared across environments even if the `SCALR_RUNNER_ROLE` variable is set.

## Remote State Code Snippet

Note: This functionality is only available is the Scalr backend is used.

To obtain the remote state code snippet for the outputs, go to the workspace dashboard and click on **Remote State Snippet**.:

<Image align="center" src="https://files.readme.io/e7c26703a3a5f315c8c649c182a84cabc4948046cb1fb0ff4a9b4f923ba6fdf4-Screenshot_2025-01-30_at_10.30.37_AM.png" />

A code snippet similar to the one below will be provided which can then be pasted into your Terraform code.

<Image align="center" src="https://files.readme.io/4decde541c809ddca5c804d8e23be5db65d54ce16a9f9284cda4022b80ee0aba-Screenshot_2024-10-03_at_10.26.12_AM.png" />

# Sibling pages

* [Agent Pools](https://docs.scalr.io/scalr/docs/agent-pools-1.md)
* [Auto-Apply Runs](https://docs.scalr.io/scalr/docs/auto-apply-runs.md)
* [Auto Queue Runs](https://docs.scalr.io/scalr/docs/auto-queue-runs.md)
* [Container Image Info](https://docs.scalr.io/scalr/docs/container-image-info.md)
* [Custom Hooks](https://docs.scalr.io/scalr/docs/custom-hooks.md)
* [Deletion Protection](https://docs.scalr.io/scalr/docs/deletion-protection.md)
* [Ephemeral Workspaces](https://docs.scalr.io/scalr/docs/epehemeral-workspaces.md)
* [Execution Mode](https://docs.scalr.io/scalr/docs/execution-mode.md)
* [Force Runs in a PR](https://docs.scalr.io/scalr/docs/force-runs-in-a-pr.md)
* [IAC Platform/Pipeline Settings](https://docs.scalr.io/scalr/docs/iac-platform.md)
* [Run Scheduler](https://docs.scalr.io/scalr/docs/drift-run-scheduler.md)
* [Run Timeout](https://docs.scalr.io/scalr/docs/run-timeout.md)
* [Run Triggers](https://docs.scalr.io/scalr/docs/run-triggers-1.md)
* [SSH Keys](https://docs.scalr.io/scalr/docs/ssh-keys.md)
* [Tags](https://docs.scalr.io/scalr/docs/tags-1.md)
* [.terraformignore](https://docs.scalr.io/scalr/docs/terraformignore.md)
* [Workspace Migration](https://docs.scalr.io/scalr/docs/workspace-migration.md)
* [Workspace Type](https://docs.scalr.io/scalr/docs/environment-types.md)