Introduction
Terramate solves the scaling problem of Infrastructure as Code. As Terraform projects grow into dozens or hundreds of root modules, teams struggle with execution order, change detection, and code duplication. Terramate adds an orchestration layer that runs commands across stacks intelligently, only targeting what changed.
What Terramate Does
- Detects which IaC stacks changed based on git diff and dependency graphs
- Orchestrates terraform/tofu commands across multiple stacks in correct dependency order
- Generates shared Terraform code (backends, providers, variables) to reduce duplication
- Detects infrastructure drift by comparing actual state against expected configuration
- Integrates with GitHub Actions, GitLab CI, and other CI/CD systems for automated workflows
Architecture Overview
Terramate organizes IaC code into stacks — independent units with their own state. A configuration language (HCL-compatible) defines stack metadata, ordering, and code generation templates. The CLI traverses the stack tree, computes a dependency-aware execution order, and runs commands in parallel where possible. Change detection uses git history to identify modified stacks and their dependents.
Self-Hosting & Configuration
- Install the CLI via Homebrew, Go install, or download binaries from GitHub releases
- Add terramate.tm.hcl files to define stacks and their relationships
- Configure code generation blocks to template shared providers and backend configurations
- Set up CI integration with terramate run --changed to only plan/apply modified stacks
- Use Terramate Cloud (optional SaaS) for drift detection dashboards and deployment history
Key Features
- Git-aware change detection reduces CI time by 80-90%% on large mono-repos
- Code generation eliminates copy-paste of provider blocks and backend configs across stacks
- Parallel execution with configurable concurrency for faster plan/apply cycles
- Stack ordering respects explicit and implicit dependencies preventing race conditions
- Works with Terraform, OpenTofu, Terragrunt, Pulumi, and any CLI-based IaC tool
Comparison with Similar Tools
- Terragrunt — wrapper focused on DRY configs and remote state; Terramate adds change detection and orchestration
- Terraform Workspaces — single state with variable switching; Terramate manages truly independent stacks
- Spacelift — commercial IaC CI/CD platform; Terramate is open-source and runs anywhere
- Atlantis — pull request automation for Terraform; Terramate adds change detection and code generation
- cdktf — write IaC in programming languages; Terramate orchestrates existing HCL without rewriting
FAQ
Q: Does Terramate replace Terraform? A: No. Terramate orchestrates Terraform (or OpenTofu). You still write HCL and use terraform plan/apply.
Q: How does change detection work? A: Terramate compares the current git branch against the base branch, identifies which files changed, maps them to stacks, and includes dependent stacks.
Q: Can I use it with Terragrunt? A: Yes. Terramate can orchestrate any CLI tool including terragrunt via terramate run -- terragrunt apply.
Q: Is Terramate Cloud required? A: No. The CLI is fully functional standalone. Terramate Cloud adds optional drift detection UI and deployment tracking.