> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ubiquex.io/llms.txt
> Use this file to discover all available pages before exploring further.

# remote

> The remote block references outputs from a stack deployed elsewhere.

The `remote` block declares a reference to a stack deployed in another workspace or repository, so you can read its outputs. It's a top-level block; the label is a bare identifier used as the local name.

## Syntax

```xcl theme={"theme":"css-variables","languages":{"custom":["/languages/xcl.json"]}}
remote networking {
  stack   = "prod-networking"
  backend = "s3://my-bucket/platform"  // optional
}
```

| Field     | Required | Description                              |
| --------- | -------- | ---------------------------------------- |
| `stack`   | yes      | Fully-qualified name of the remote stack |
| `backend` | no       | State backend URL for the remote stack   |

A `remote` block reads another stack's outputs by **pointing at that stack's state**:

* **`stack`** (required) — the fully-qualified name of the target stack. This name is the link to its state.
* **`backend`** (optional) — the state backend URL of the target stack, used when it differs from the current backend.
* The block's **label** (`name`) is the local binding, referenced as `remote.<name>.<output>`.

The block compiles to a Pulumi `StackReference`.

When `backend` is present it is emitted as a comment in the generated Python; the actual backend URL must be supplied at runtime via the `PULUMI_BACKEND_URL` environment variable.

## Accessing remote outputs

Reference remote outputs with `remote.<name>.<output>`:

```xcl theme={"theme":"css-variables","languages":{"custom":["/languages/xcl.json"]}}
remote networking {
  stack = "prod-networking"
}

stack application {
  instance = aws.ec2.Instance {
    subnet_id       = remote.networking.subnet_id
    security_groups = remote.networking.security_group_ids
  }
}
```

Remote outputs are pending values — they resolve at apply time by reading the remote stack's state. Output names are recorded as dependencies but not hard-validated, so a typo surfaces at apply time rather than at compile time.

## How it works

The Pulumi engine generates a `StackReference` to the remote stack, and each `remote.<name>.<output>` becomes a `get_output` call:

```python theme={"theme":"css-variables","languages":{"custom":["/languages/xcl.json"]}}
networking_ref = pulumi.StackReference("prod-networking")
subnet_id = networking_ref.get_output("subnet_id")
```

## vs cross-stack references

Within a single workspace, use the `@stack.output` syntax instead:

|             | `@stack.output`      | `remote <name>`                      |
| ----------- | -------------------- | ------------------------------------ |
| Scope       | Same workspace       | A separately deployed stack          |
| Syntax      | `@networking.vpc_id` | `remote.networking.vpc_id`           |
| Declaration | Implicit             | Explicit `remote` block with `stack` |
