Terramate claims to aid your battle for DRYer Terraform code and more manageable stacks – the runnable, loosely-defined Root Modules that maintain independent states and run on a subset of the infrastructure's resources. This tool lets you create relationships between stacks to improve your conceptual grasp and oversight capabilities.
Terramate also helps you orchestrate stack commands without majorly changing how you work. All configurations are essentially plaintext files. They use Hashicorp Configuration Language, also known as HCL, so if you've ever dipped your toes into Terraform, you pretty much have the skills needed to get started.
Focus
Terramate's orchestration and management powers revolve around heightening ease of use. Most notably, this tool supports data sharing as a means of solving code duplication, a significant problem with Terraform setups that depend on common resources.
Terramate's version of HCL configuration introduces global variables for straightforward inter-stack sharing. Thanks to lazy evaluation and generation support, you can create and reference complex globals in other configs without winding up in dependency hell. This tool also supports Git-based change detection, and the devs say other VCS integrations are forthcoming.
Terramate's data-sharing revolves around a hierarchical view of stacks that informs its orchestration capabilities. On top of accessing shared data from within a stack, you can run commands on known stacks using a single command, or execute commands on all stacks that are reachable from a specific directory.
Terramate ships with safeguards designed to prevent undefined behaviors. For example, one of the built-in safety features stops you from running commands on uncommitted files. That being said, this tool doesn't hold your hand all the way.
What's the verdict on Terramate's purported usability improvements? Unfortunately, this tool may require a significant amount of nudging to work as you expect – even with code generation. For instance, you'll still need to decide whether to execute tasks at runtime or during the build stages, and if individual stacks use other stacks as dependencies, you'll have to wire those up properly in your configs.
Background
Terramate is a relatively fresh contender in the open-source DevOps arena. Its first release hit GitHub in late 2021.
Is switching to Terramate an uncertain gamble? As of this review (mid-2022), it looks like most users can get started without too many wrong turns – Most problems they encounter have to do with how they're using Terraform and HCL, not Terramate itself. For now, it's probably a good idea to keep an eye on the Mineiros Slack channel before trying anything big.
Terramate main features
Change detection
Terramate detects changes at the stack and module level. This lets you identify which stacks and resources have been changed but also be selective in where you execute commands.
Pure HCL configuration
Terramate's use of HCL seems to smooth out the kinks in the learning process for many novices. Since this tool doesn't add much in the way of new keywords, you can make changes without dramatically revamping your configs.
Centralized orchestration and data sharing
Terramate gives you multiple options for choosing how you run commands and orchestrate tasks – whether you need to execute them on all stacks or a selected few. It centralizes data sharing, hopefully making resource organization a bit easier. Also, the fact that it isn't a Terraform wrapper but rather an extension of sorts means you can attempt any job you'd usually run on one of your stacks.