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

# output

> The output block exports values from a stack for use by other stacks or callers.

The `output` block declares values that are exported from a stack. Outputs become `pulumi.export()` calls in the generated Python program. Other stacks can consume them via `@stackName.outputName` cross-stack references.

## Syntax

```xcl theme={"theme":"css-variables"}
output "name" {
    field_name = expr
    field_name = expr
}
```

## Example

```xcl theme={"theme":"css-variables"}
output "networking" {
    vpc_id     = vpc.id
    subnet_ids = subnets.id
}
```

Generated Python:

```python theme={"theme":"css-variables"}
# ── Outputs ───────────────────────────────────────────────────────────────────
pulumi.export("vpc_id", vpc.id)
pulumi.export("subnet_ids", [r.id for r in subnets])
```

## Referencing outputs from other stacks

Once a stack exports an output, a sibling stack can reference it with `@stackName.outputName`:

```xcl theme={"theme":"css-variables"}
// cluster/stack.xcl
stack "cluster" {
    eks = aws.eks.Cluster {
        vpc_id     = @networking.vpc_id
        subnet_ids = @networking.subnet_ids
    }
}
```

See [Multi-stack workspaces](/v1/xcl/guides/multi-stack-workspaces) for how sibling discovery works.

## What expressions are valid

Output field values can reference:

* Resource outputs: `vpc.id`, `subnets.id`
* Input fields: `input.vpc_cidr`
* Locals fields: `locals.computed_value`
* Cross-stack refs: `@otherStack.someOutput`
* Literals: `"static"`, `42`, `true`

The typechecker resolves all references. Undefined names produce an error:

```xcl theme={"theme":"css-variables"}
output "s" {
    id = myresource.id  // error if "myresource" is not declared in a stack block
}
```

## Duplicate field names

Output field names must be unique across all `output` blocks in the stack:

```xcl theme={"theme":"css-variables"}
// file-a.xcl
output "a" { vpc_id = vpc.id }
// file-b.xcl
output "b" { vpc_id = vpc.id }  // error: "vpc_id" is already defined in file-a.xcl:2 - remove one, or rename
```

## Multiple output blocks

A stack may have multiple `output` blocks (typically one per file). All field names share a flat namespace.
