Skip to main content

Abstract Component

Atmos Design Pattern

The Abstract Component pattern marks a component as a blueprint that cannot be deployed directly. Abstract components serve as base configurations that other components inherit from, preventing accidental deployment of incomplete or template configurations.

Use-cases​

Use the Abstract Component pattern when:

  • You have base components that should never be deployed on their own

  • You want to prevent accidental atmos terraform apply on template configurations

  • You need a clear distinction between "blueprints" and "deployable" components

How It Works​

Set metadata.type: abstract to mark a component as non-deployable:

stacks/catalog/vpc/defaults.yaml
components:
terraform:
vpc/defaults:
metadata:
type: abstract # Cannot be deployed directly
vars:
enabled: true
nat_gateway_enabled: true
max_subnet_count: 3

Components that inherit from abstract components are deployable by default:

stacks/deploy/prod.yaml
import:
- catalog/vpc/defaults

components:
terraform:
vpc:
metadata:
component: vpc
inherits:
- vpc/defaults # Inherits from abstract component
vars:
name: prod-vpc

Error on Deploy Attempt​

If you try to deploy an abstract component:

atmos terraform apply vpc/defaults -s prod

Atmos returns an error:

Terminal
abstract component 'vpc/defaults' cannot be provisioned since it's explicitly
prohibited from being deployed by 'metadata.type: abstract' attribute

When to Use Abstract vs Real​

TypeUse When
abstractBase configurations, templates, shared defaults
real (default)Deployable components in actual stacks
tip

If you don't specify metadata.type, the component defaults to real and can be deployed.

References​