Abstract Component
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 applyon 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 that inherit from abstract components are deployable by default:
stacks/deploy/prod.yaml
Error on Deploy Attempt
If you try to deploy an abstract component:
atmos terraform apply vpc/defaults -s prod
Atmos returns an error:
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
| Type | Use When |
|---|---|
abstract | Base configurations, templates, shared defaults |
real (default) | Deployable components in actual stacks |
If you don't specify metadata.type, the component defaults to real and can be deployed.
Related Patterns
- Component Inheritance - How components inherit from abstract bases
- Multiple Component Instances - Deploy multiple instances from one abstract base
- Component Catalog - Organize abstract and real components