Which strategy best manages global variable propagation across hierarchical stacks in Terramate?
22K reputation · 23 Apr 2021, 00:38 UTC
Terramate functions as an orchestration layer that generates Terraform configurations across multiple stacks. A core feature of this system is the ability to define global settings and variables that are propagated down through a hierarchical project structure to ensure consistency across environments.
When managing a complex hierarchy, there is a tension between centralizing variable definitions for ease of maintenance and allowing specific stacks to override these values without breaking the generation logic for other dependent units. Over-reliance on complex templates can potentially obscure the final HCL output, making it difficult to trace where a specific variable value originated during the generation phase.
What are the recommended patterns for balancing global variable propagation with stack-specific overrides? Does Terramate provide a native mechanism to enforce variable constraints across the hierarchy to prevent invalid configurations in the generated .tf files?