flowchart TB
subgraph Author["Author"]
ED[Editor + terraform-ls] --> FMT[fmt · tflint · terraform-docs]
FMT --> PC[pre-commit · scanners]
end
subgraph Run["Run"]
ENG[Terraform / OpenTofu]
ORCH[Terragrunt · Terramate · Atmos · HCP Stacks]
ORCH --> ENG
end
subgraph Automate["Automate"]
CI[GitLab CI · GitHub Actions · TeamCity]
TACOS[Atlantis · HCP Terraform · Spacelift · env0 · Scalr]
end
subgraph Govern["Govern"]
POL[Conftest/OPA · Sentinel · tfpolicy · Checkov · Trivy]
COST[Infracost]
DRIFT[scheduled plans · health assessments]
end
Author --> Run --> Automate --> Govern
Engines¶
| Tool |
What |
Page |
| Terraform |
HashiCorp's original, BSL-licensed |
This guide |
| OpenTofu |
MPL-licensed Linux Foundation fork |
OpenTofu |
Version managers¶
tenv, tfenv, mise, asdf: version managers.
Orchestration and DRY wrappers¶
| Tool |
Approach |
Notes |
| Terragrunt |
HCL wrapper: generated backends/providers, includes, cross-stack dependency DAG, explicit stacks |
Full guide |
| Terramate |
Stacks + code generation + Git-based change detection, plain Terraform underneath |
Good if you want orchestration without a wrapper CLI on every run |
| Atmos (Cloud Posse) |
YAML stack configs with deep inheritance, drives Terraform components |
Opinionated; strong for large multi-account AWS estates |
| HCP Terraform Stacks |
Native components + deployments |
HCP-only (advanced) |
| Make / just / shell / your own CLI |
Wrappers around init -backend-config and -var-file |
Fine for small estates |
Atlantis, HCP Terraform, Spacelift, env0, Scalr, Terrateam, Digger, Terragrunt Scale. Compared in CI/CD.
Testing¶
| Tool |
Use |
terraform test / tofu test |
Built-in unit and integration tests, mocks (testing) |
| Terratest |
Go library for apply-and-verify tests |
| Conftest on plan JSON |
Contract tests ("no deletes", required tags) |
Linting, security and policy¶
| Tool |
Use |
| TFLint (+ azurerm/aws/google rulesets) |
Provider-aware linting (hygiene) |
| Checkov, Trivy (ex-tfsec), KICS |
Misconfiguration scanning (scanning tools) |
| gitleaks, trufflehog, detect-secrets |
Secret scanning |
| Conftest / OPA, Sentinel, tfpolicy |
Policy as code (policy) |
| Azure Policy, AWS SCPs |
Cloud-side enforcement |
Documentation¶
| Tool |
Use |
| terraform-docs |
Generate module READMEs from variables/outputs |
terraform graph -format=mermaid (1.16+) |
Dependency diagrams for docs and MRs |
| Inframap, Rover |
Visualise state/plan as architecture diagrams (check maintenance status) |
Cost¶
Infracost reads plan JSON and estimates the monthly cost and the cost delta of a change, posted as an MR comment. Useful for catching "someone changed the SKU from B1 to P3v3" in review. HCP Terraform has its own cost estimation for some resource types.
Import, export and discovery¶
| Tool |
Use |
import blocks + -generate-config-out |
Adopt existing resources (refactoring) |
terraform query (1.14+) |
Discover unmanaged resources via providers' list resources |
| aztfexport (Microsoft) |
Export existing Azure resource groups or resources to Terraform config + state |
| Terraformer (Google, community) |
Multi-cloud export; less maintained than it was |
Editors and language servers¶
- terraform-ls: HashiCorp's language server (VS Code extension, Neovim, Helix, Zed)
- tofu-ls: OpenTofu's fork of it
hcl-rs (Rust), python-hcl2, hcl2json, hashicorp/hcl (Go): parse HCL in your own tools
AI-assisted authoring¶
- HashiCorp's Terraform MCP server gives AI assistants live registry data (provider docs, module versions) so generated configuration uses real, current schemas.
- Treat generated configuration like any other contribution:
validate, lint, scan, plan, review. Models are trained on large public corpora of Terraform; datasets such as TerraDS show how much of that public code is untested, insecure or outdated.
| Tool |
Approach |
Status |
| CDK for Terraform (CDKTF) |
TypeScript/Python/Go/C#/Java synthesising Terraform JSON |
Deprecated by HashiCorp; don't start new work on it |
| Pulumi |
General-purpose languages, own engine and state |
Mature, commercial + OSS |
| Crossplane |
Kubernetes controllers reconciling cloud resources continuously |
Fits GitOps-centric platforms |
| Azure Bicep / ARM, AWS CloudFormation/CDK |
Cloud-native IaC |
Single-cloud; no state file to manage |
| Azure Service Operator, AWS Controllers for Kubernetes |
Kubernetes-native per-cloud controllers |
For app teams living in Kubernetes |
Research and datasets¶
| Resource |
What |
| TerraDS |
62k+ permissively licensed open-source Terraform repositories with module/resource metadata in SQLite, for mining real-world HCL |
| IaC-Eval, TF-Gen |
Benchmarks and datasets for evaluating LLM-generated Terraform (TF-Gen was built partly from TerraDS) |