Overview
Infrastructure changes flow through Terramate and GitHub. Whether you’re modifying an existing stack, adding a new resource, or creating entirely new infrastructure, the workflow is the same: make changes locally, open a PR, review the plan, and merge to apply.Workflow
1
Make your changes
Edit the relevant files in
terraform/. This might be:- Stack configuration (
config.tm.hcl,inputs.tm.hcl) - Module code in
terraform/modules/ - New stack definitions (
stack.tm.hcl)
2
Generate files (if needed)
If you changed any Terramate configuration (This updates generated files like
.tm.hcl files), regenerate the Terraform files:_backend.tf, _provider.tf, and _main.tf.3
Validate locally (optional)
Test your changes before pushing:
4
Open a pull request
Push your branch and open a PR. The CI workflow will:
- Check Terramate formatting
- Detect changed stacks
- Run
terraform planfor each affected stack - Sync preview results to Terramate Cloud
5
Review the plan
Check the plan output in:
- GitHub Actions logs
- PR comment with plan summary (if using Terramate Cloud)
- Terramate Cloud dashboard (for a unified view across stacks)
- Expected resource changes (create, update, destroy)
- No unintended side effects
- Correct dependency ordering
6
Merge to apply
Once approved, merge the PR. The deploy workflow will:
- Detect changed stacks
- Apply changes in dependency order
- Sync deployment results to Terramate Cloud
Common Tasks
Adding a New Stack
-
Create directory under
terraform/live/{stage}/{region}/: -
Create
stack.tm.hcl:Replace<region-abbrev>(e.g.,use2) and<REGION>(e.g.,us-east-2) with your values. -
Create
config.tm.hclwith stack-specific globals -
Create
main.tfor use module mixins -
Generate files:
You may need to run
terramate generatetwice. The first pass generates_outputs.tm.hclfor some stacks (e.g., EKS), which is then used by dependent stacks in the second pass.
Modifying a Module
- Edit the module in
terraform/modules/{module-name}/ - Open a PR - Terramate will plan all stacks that use the module
- Review plans across all affected environments
- Merge to apply changes everywhere
Targeting Specific Stacks
Use tags to run commands on specific stacks:Troubleshooting
”Repository has untracked files”
Terramate requires a clean git state. Either stage your changes or use:Missing dependency outputs
When a dependency stack hasn’t been applied yet, Terramate uses mock values. This is expected during initial bootstrap. Apply stacks in dependency order:Regenerate after config changes
If you see drift between generated files and configuration:Configuration Reference
Root Configuration
Theterraform/config.tm.hcl defines globals inherited by all stacks:
Terramate Project Configuration
Theterramate.tm.hcl at the repository root configures Terramate features:
Stack Definition
Each stack requires astack.tm.hcl:
Stack-Specific Configuration
Override globals inconfig.tm.hcl within each stack:
Outputs Sharing
Cross-stack dependencies withoutterraform_remote_state:
Terramate Scripts
Theterraform/scripts.tm.hcl file defines reusable commands used by CI:
Mixins
Code generation templates live interraform/imports/mixins/. These generate common files (_backend.tf, _provider.tf, _main.tf) from templates, eliminating copy-paste between stacks.