Skip to main content
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

interface "name" {
  output "output_name" {
    type        = "string"
    description = "What this output provides"
  }
}

Example

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