Mixins
Mixins are reusable configuration fragments that encapsulate settings you want to apply consistently. Instead of repeating the same values across multiple stacks, define them once in a mixin and import where needed.
Use-cases
Use Mixins when:
-
You repeat the same configuration across multiple stacks
-
You want region-specific defaults (availability zones, region name)
-
You want stage-specific defaults (instance sizes, feature flags)
-
Different teams should share consistent settings
Two Places for Mixins
Mixins can live in two locations depending on their scope:
| Location | Scope | Examples |
|---|---|---|
stacks/mixins/ | Global settings that apply across many components | Region defaults, stage defaults, tenant defaults |
stacks/catalog/<component>/mixins/ | Component-specific feature flags and versions | vpc/mixins/multi-az, eks/mixins/1.27 |
Common Global Mixin Types
| Mixin Type | Contains | Example |
|---|---|---|
| Region | Region name, AZs, environment abbreviation | mixins/region/us-east-2.yaml |
| Stage | Stage name, stage-specific defaults | mixins/stage/prod.yaml |
| Tenant | Team/OU name, team-specific settings | mixins/tenant/platform.yaml |
Example: Region Mixins
Region mixins encapsulate everything that's consistent for a region:
Now stacks import the region mixin instead of repeating these values:
Example: Stage Mixins
Stage mixins define defaults for each environment:
Example: Catalog Mixins (Feature Flags)
Mixins inside a component's catalog folder enable optional features:
Stack files pick the features they need:
Example: Catalog Mixins (Versions)
Version mixins are perfect for components like EKS where different clusters may run different versions:
Upgrade clusters independently by changing which version mixin they import:
Import Order Matters
Later imports override earlier ones. Order from general to specific:
import:
- catalog/vpc/defaults # 1. Component defaults (most general)
- catalog/vpc/mixins/multi-az # 2. Feature flags
- mixins/region/us-east-2 # 3. Region settings
- mixins/stage/prod # 4. Stage settings (most specific)