Skip to main content

Component Inheritance

Atmos Design Pattern

The Component Inheritance pattern allows an Atmos component to inherit configuration from a base component, then override specific values. This creates DRY configurations where common settings are defined once and reused.

Use-cases

Use the Component Inheritance pattern when:

  • Multiple components share common configuration

  • You want to define defaults once and override only what differs

How It Works

A component inherits from a base component using metadata.inherits:

stacks/catalog/vpc/defaults.yaml

components:
terraform:
vpc/defaults:
vars:
enabled: true
nat_gateway_enabled: true
max_subnet_count: 3

stacks/deploy/dev.yaml

import:
- catalog/vpc/defaults

components:
terraform:
vpc:
metadata:
component: vpc
inherits:
- vpc/defaults
vars:
# Override only what's different
max_subnet_count: 2

The vpc component inherits all vars from vpc/defaults, then overrides max_subnet_count.

Inheritance Order

When multiple sources define the same value, later sources win:

base component → inherited components (in order) → inline vars

This allows progressive specialization from general defaults to specific overrides.

References