> ## 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 block

> Reference another stack's outputs with the remote block.

The `remote` block declares a reference to another ubx stack. Its outputs are accessed via `~@name.output` syntax.

## Syntax

```hcl theme={null}
remote "name" {
  source = "github.com/org/repo//stacks/networking"
  stack  = "${input.env}"
}
```

## Fields

| Field    | Required | Description                                  |
| -------- | -------- | -------------------------------------------- |
| `source` | yes      | GitHub repo path to the stack directory      |
| `stack`  | no       | Pulumi stack name (defaults to `defaultEnv`) |

## Example

```hcl theme={null}
# Declare reference to networking stack
remote "networking" {
  source = "github.com/myorg/platform//stacks/networking"
  stack  = "${input.env}"
}

# Use its outputs with ~@name.output
unit "aws_subnet" "app" {
  vpc_id            = ~@networking.vpc_id
  availability_zone = "eu-west-1a"
  cidr_block        = cidrsubnet(~@networking.vpc_cidr, 8, 1)
}
```

## Reference Syntax

```hcl theme={null}
~@remote_name.output_name
```

Cross-stack references are always `Pending&lt;T&gt;`.

## Workspace Usage

`remote` blocks are typically declared alongside a `workspace` block for multi-stack orchestration:

```hcl theme={null}
workspace "platform" {
  stack "networking" {
    path = "./stacks/networking"
  }
  stack "apps" {
    path       = "./stacks/apps"
    depends_on = ["networking"]
  }
}

remote "networking" {
  source = "./stacks/networking"
  stack  = input.env
}
```

## Generated TypeScript

```typescript theme={null}
const networking = new pulumi.StackReference(
  `myorg/networking/${env}`
);

// ~@networking.vpc_id
const app = new aws.ec2.Subnet("app", {
    vpcId: networking.getOutput("vpc_id"),
});
```
