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

# interface block

> Define required output contracts for a stack.

The `interface` block declares the outputs a stack is required to export. Acts as a compile-time contract — `ubx validate` fails if any declared interface output is missing from the stack's `output` blocks.

## Syntax

```hcl theme={null}
interface "name" {
  output "output_name" {
    type        = "string"
    description = "What this output provides"
  }
}
```

## Example

```hcl theme={null}
# Declare that this stack must export vpc_id and vpc_cidr
interface "networking_contract" {
  output "vpc_id" {
    type        = "string"
    description = "VPC ID for use by downstream stacks"
  }

  output "vpc_cidr" {
    type        = "string"
    description = "VPC CIDR block"
  }
}

# These outputs satisfy the interface
output "vpc_id" {
  value = ~unit.aws_vpc.main.id
}

output "vpc_cidr" {
  value = ~unit.aws_vpc.main.cidr_block
}
```

If either `output` is missing, `ubx validate` produces:

```
✗  stack.iac  interface "networking_contract" requires output "vpc_id" but it is not declared
```

## Purpose

* Enforces output contracts between stacks in multi-stack architectures
* Catches missing outputs at compile time rather than at apply time
* Documents what a stack is expected to provide for consumers

## No TypeScript Emitted

`interface` blocks are compile-time only — no TypeScript is emitted.
