Type-Aware Merging of YAML Functions
Atmos supports type-aware merging of YAML functions and concrete values, allowing them to coexist in the inheritance chain without type conflicts.
The Problem: Type Conflicts During Merge
When merging stack configurations, Atmos needs to handle both concrete values and YAML function references. Without special handling, the merge process would encounter type mismatches:
# Base catalog (catalog/app/defaults.yaml)
components:
terraform:
my-app:
vars:
database_url: "postgresql://localhost:5432/mydb" # Concrete string value
# Environment override (stacks/prod/app.yaml)
components:
terraform:
my-app:
vars:
database_url: !env DATABASE_URL # YAML function reference
The YAML function !env DATABASE_URL is a different type than the string "postgresql://localhost:5432/mydb". Without special handling, merging these would cause a type conflict error.