10 Must-Have Tools for Terraform Productivity

10 tools that make Terraform faster and safer: Terragrunt, TFLint, Checkov, Trivy, Conftest, Infracost, Terratest, terraform-docs, Atlantis, pre-commit.

Dec 10, 2025 - 12:39
Nov 10, 2026 - 14:55
 0  192
10 Must-Have Tools for Terraform Productivity

The tools that save the most time around Terraform are Terragrunt for keeping environments DRY, TFLint and Checkov for catching errors and misconfigurations, Trivy for security scanning, Conftest for policy checks, Infracost for cost in pull requests, Terratest for testing, terraform-docs for module docs, Atlantis for pull request workflows and pre-commit-terraform to run them all.

Each tool below was checked against its official documentation or repository in November 2026. Two tools from older versions of this list were removed: CDK for Terraform (CDKTF), which HashiCorp deprecated and archived on 10 December 2025, and Terrascan, which we replaced with tools that are more actively documented. tfsec users should note that Aqua Security now directs tfsec users to Trivy.

Key takeaways

  • Start with the cheapest wins: terraform fmt, terraform validate, TFLint and pre-commit hooks on every laptop and in CI.
  • Add one security scanner (Checkov or Trivy) and one cost tool (Infracost) to pull requests so reviewers see risk and cost before merge.
  • Use Terragrunt or a clear root module layout once you manage several environments or accounts.
  • Run plans and applies through a controlled workflow such as Atlantis or HCP Terraform instead of from laptops.
  • CDKTF is deprecated. HashiCorp suggests moving such projects to HCL, and cdktf synth --hcl can generate .tf files as a starting point.
  • Terraform's built-in terraform test framework covers many module tests; Terratest is still useful for end-to-end checks against real infrastructure.

Where these tools fit in the workflow

If you are new to Terraform, read how Terraform fits into the DevOps workflow first. For a comparison of Terraform against other IaC tools, see 12 infrastructure as code tools ranked. This post covers the tools that sit around Terraform itself.

StageToolWhat it saves you
Writing codepre-commit-terraform, TFLintFormatting, syntax and provider mistakes found before commit
Code layoutTerragruntRepeated backend and provider blocks across environments
Documentationterraform-docsHand-written module README tables going out of date
SecurityCheckov, TrivyOpen security groups, unencrypted storage, public buckets
PolicyConftest (OPA)Company rules checked by hand in reviews
CostInfracostSurprise bills after merge
TestingTerratest, terraform testModules that plan cleanly but do not work
DeliveryAtlantisPlans run from laptops with unreviewed changes

1. Terragrunt: keep environments DRY

Terragrunt, from Gruntwork, is a thin wrapper that runs Terraform (or OpenTofu) with shared configuration. It is most useful when you have the same modules deployed to many environments, accounts or regions.

What it does well

  • Generates backend configuration so each unit gets its own state key without copy and paste.
  • Shares inputs and provider settings through included parent files.
  • Handles dependencies between units, passing outputs from one into another, and runs commands across many units at once.
# root.hcl
remote_state {
  backend = "s3"
  generate = {
    path      = "backend.tf"
    if_exists = "overwrite"
  }
  config = {
    bucket       = "acme-tf-state"
    key          = "${path_relative_to_include()}/terraform.tfstate"
    region       = "ap-south-1"
    encrypt      = true
    use_lockfile = true
  }
}

# prod/vpc/terragrunt.hcl
include "root" {
  path = find_in_parent_folders("root.hcl")
}
terraform {
  source = "git::https://github.com/acme/terraform-modules.git//vpc?ref=v1.4.0"
}
inputs = {
  cidr_block = "10.20.0.0/16"
}

Terragrunt's CLI and file names changed in recent releases (for example the newer run command and root.hcl naming), so follow the current Terragrunt docs rather than older blog posts. S3 native locking with use_lockfile needs a recent Terraform version; older setups use a DynamoDB table.

When to skip it

For one or two environments, plain Terraform with separate root modules and a .tfvars file each is simpler. Add Terragrunt when the repetition starts causing mistakes.

2. TFLint: catch mistakes that validate misses

terraform validate checks syntax and internal consistency. TFLint goes further with rules for deprecated syntax, unused declarations, naming conventions and, through provider plugins, invalid values such as an EC2 instance type that does not exist.

# .tflint.hcl
plugin "terraform" {
  enabled = true
  preset  = "recommended"
}

plugin "aws" {
  enabled = true
  version = "0.40.0"
  source  = "github.com/terraform-linters/tflint-ruleset-aws"
}
tflint --init
tflint --recursive

Check the ruleset's releases page for the current plugin version before pinning it.

3. Checkov: policy checks for misconfigurations

Checkov, an open source project maintained by Prisma Cloud (Palo Alto Networks), scans Terraform code and plans for security and compliance issues using a large library of built-in checks. It also scans Kubernetes, CloudFormation, Dockerfiles and more, which helps teams that want one scanner.

pip install checkov
checkov -d . --framework terraform

# scan a plan to include values from variables and modules
terraform plan -out tf.plan
terraform show -json tf.plan > tf.json
checkov -f tf.json

Suppress a finding inline only with a reason, so reviewers can see why it was accepted.

resource "aws_s3_bucket" "public_site" {
  #checkov:skip=CKV_AWS_18:Access logging handled by CloudFront for this static site
  bucket = "acme-public-site"
}

4. Trivy: one scanner for IaC, images and dependencies

Trivy, from Aqua Security, scans container images, file systems, Git repositories and IaC files. Its misconfiguration scanning took over from tfsec, and the tfsec repository points users to a migration guide for Trivy. If your team already uses Trivy for images, using it for Terraform keeps one tool and one report format.

trivy config ./infra
trivy config --severity HIGH,CRITICAL --exit-code 1 ./infra

Choose either Checkov or Trivy for blocking checks in CI. Running both usually doubles the noise without much extra coverage.

5. Conftest with Open Policy Agent: your own rules as code

Built-in scanners check general best practice. Company rules, such as "every resource must have a cost-center tag" or "only these instance families in production", need custom policy. Conftest runs Open Policy Agent policies written in Rego against structured data such as a Terraform plan in JSON.

# policy/tags.rego
package main

import rego.v1

deny contains msg if {
  rc := input.resource_changes[_]
  rc.change.actions[_] == "create"
  tags := object.get(rc.change.after, "tags", {})
  not tags["cost-center"]
  msg := sprintf("%s is missing the cost-center tag", [rc.address])
}
terraform show -json tf.plan > tf.json
conftest test tf.json

Teams on HCP Terraform or Terraform Enterprise can also use Sentinel or OPA policy sets there. Keep policies in Git with tests, like any other code.

6. Infracost: cost estimates in pull requests

Infracost reads Terraform code or plans, prices the resources from cloud pricing data, and shows the monthly cost and the difference a change makes. Its CI integrations post that diff as a pull request comment, so a reviewer sees that a change adds a large database before it is merged.

infracost auth login
infracost breakdown --path .
infracost diff --path . --compare-to infracost-base.json

Usage-based costs, such as data transfer or requests, need a usage file to be estimated well. Treat the output as an estimate and pair it with cloud budgets and alerts.

7. Terratest and terraform test: prove modules work

A plan that succeeds can still produce infrastructure that does not work. Terraform's native test framework, run with terraform test and .tftest.hcl files, lets you write assertions in HCL and is a good first step for module tests. Terratest, a Go library from Gruntwork, deploys real infrastructure, checks it (for example by making an HTTP request to a load balancer), and destroys it afterwards.

# tests/bucket.tftest.hcl
run "bucket_name_has_prefix" {
  command = plan

  variables {
    name = "acme-logs"
  }

  assert {
    condition     = startswith(aws_s3_bucket.this.bucket, "acme-")
    error_message = "Bucket name must start with acme-"
  }
}

Run real-infrastructure tests in a separate sandbox account, tag test resources, and clean up on failure so tests do not leave costly resources behind.

8. terraform-docs: module documentation that stays current

terraform-docs generates a table of inputs, outputs, providers and resources from your module and can inject it into the README between markers. Running it in pre-commit means documentation updates with every change.

terraform-docs markdown table --output-file README.md --output-mode inject ./modules/vpc

Well-described variables (with description, type and validation blocks) make the generated docs useful. Our post on reusable Terraform modules covers module design.

9. Atlantis: plan and apply from pull requests

Atlantis is a self-hosted application that listens for pull request webhooks, runs terraform plan and posts the output as a comment. After approval, a reviewer comments atlantis apply to apply. It locks each project while a pull request is open so two changes do not fight over the same state.

# atlantis.yaml
version: 3
projects:
  - name: prod-network
    dir: envs/prod/network
    autoplan:
      when_modified: ["*.tf", "../../../modules/network/**/*.tf"]
    apply_requirements: [approved, mergeable]

Atlantis needs cloud credentials, so run it in a locked-down environment with short-lived credentials. HCP Terraform, Spacelift, env0 and similar platforms offer managed alternatives with the same pull request flow.

10. pre-commit-terraform: run everything before you push

pre-commit-terraform is a collection of hooks for the pre-commit framework. One config file runs formatting, validation, TFLint, terraform-docs, Checkov or Trivy on each commit, which keeps CI failures rare.

# .pre-commit-config.yaml
repos:
  - repo: https://github.com/antonbabenko/pre-commit-terraform
    rev: v1.99.0
    hooks:
      - id: terraform_fmt
      - id: terraform_validate
      - id: terraform_tflint
      - id: terraform_docs
      - id: terraform_checkov

Pin rev to a current release from the repository and run the same hooks in CI with pre-commit run --all-files, since developers can skip local hooks.

Other helpers worth knowing

  • tenv, a version manager for Terraform, OpenTofu and Terragrunt, so each repository can pin its own versions. It is a common replacement for tfenv.
  • OpenTofu, the open source fork of Terraform under the Linux Foundation, which most of the tools above also support.
  • The terraform console command, for testing expressions and functions before putting them in code.

A sample pipeline that combines the tools

  1. On commit: pre-commit runs terraform fmt, validate, TFLint and terraform-docs.
  2. On pull request: CI runs Checkov or Trivy, creates a plan, runs Conftest policies on the plan JSON and posts an Infracost diff.
  3. Atlantis or HCP Terraform posts the plan for review and applies after approval.
  4. Nightly: module tests run with terraform test and Terratest in a sandbox account, and a drift check runs terraform plan against production.

Store state remotely with locking and keep secrets out of code; see remote state management in Terraform and storing secrets in Terraform projects. If you are preparing for interviews, our Terraform scenario-based interview questions ask about many of these tools.

For hands-on practice with Terraform, modules, state and CI pipelines, see our Terraform training, run in Kharadi, Pune and live online.

The ten tools compared

ToolMaintainerRuns whereInput it readsGood first use
TerragruntGruntworkLaptop and CIHCL filesGenerate backend config per environment
TFLintterraform-linters projectLaptop and CI.tf filesRecommended preset plus your cloud ruleset
CheckovPrisma Cloud (Palo Alto Networks)Laptop and CI.tf files or plan JSONBlock high severity findings on pull requests
TrivyAqua SecurityLaptop and CI.tf files, images, reposOne scanner for IaC and images
ConftestOpen Policy Agent projectCIPlan JSON and other structured filesMandatory tags and allowed regions
InfracostInfracostCI.tf files or plan JSONCost diff comment on pull requests
TerratestGruntworkCI with a sandbox accountGo test codeEnd-to-end test of one shared module
terraform-docsterraform-docs projectLaptop and CIModule sourceInject input and output tables into READMEs
AtlantisAtlantis open source communitySelf-hosted serverPull request webhooksPlan on every pull request, apply after approval
pre-commit-terraformOpen source (Anton Babenko and contributors)Laptop and CIChanged filesfmt, validate and TFLint on commit

How to roll the tools out without slowing the team

Adding all ten at once usually creates a wall of warnings that people learn to ignore. A staged rollout works better.

  1. Week 1: add pre-commit with terraform fmt, validate and TFLint. Fix existing findings in one cleanup pull request so new pull requests start clean.
  2. Week 2: add Checkov or Trivy in CI in report-only mode. Review the findings with the team, decide which checks matter, and skip the rest with written reasons.
  3. Week 3: switch the security scan to blocking for high and critical findings, and add Infracost comments on pull requests.
  4. Week 4: add terraform-docs for shared modules and write the first Conftest policies for company rules, such as required tags.
  5. Later: move plan and apply into Atlantis or a managed platform, and add terraform test or Terratest for shared modules.

Measure whether the rollout helps. Useful signals are the number of pull requests that fail CI on formatting or lint errors (it should fall as pre-commit catches them earlier), the number of security findings that reach production plans, and how long a typical Terraform pull request waits for review. If a tool adds noise without catching real problems, tune it or remove it.

Keep tool versions pinned in one place (a .pre-commit-config.yaml, a CI image or tenv configuration) so laptops and CI give the same results.

Common mistakes with Terraform tooling

  • Running scanners only on .tf files when values come from variables and modules. Scanning the plan JSON catches what the final configuration really creates.
  • Skipping checks without a reason. Inline skips should say why, so the next reviewer can judge whether the reason still holds.
  • Giving Atlantis or CI runners broad, long-lived cloud credentials. Use short-lived credentials through OIDC and limit each project's role to what it manages.
  • Treating Infracost numbers as exact. Usage-based charges need realistic usage files, and real bills still need budgets and alerts.
  • Letting Terragrunt hide too much. If engineers cannot find which module version a unit uses, add clear naming and pin module sources to tags.
  • Running Terratest against shared accounts. Real-infrastructure tests belong in a sandbox account with automatic cleanup.

Frequently asked questions

Which Terraform tool should I add first?

Start with pre-commit hooks running terraform fmt, terraform validate and TFLint. They are free, fast and catch the most common mistakes before code reaches review.

Is CDK for Terraform still a good choice?

No. HashiCorp deprecated and archived CDKTF on 10 December 2025, and it receives no further updates. HashiCorp suggests moving to HCL; cdktf synth --hcl can generate .tf files to start from.

Is tfsec still maintained?

Aqua Security now directs tfsec users to Trivy, which includes tfsec's checks through trivy config. New projects should use Trivy or Checkov instead.

Checkov or Trivy: which should I use?

Both scan Terraform well. Choose Trivy if you already use it for container images, or Checkov if you want its wide policy library across many IaC formats. Using one as the blocking check keeps CI output manageable.

Do I need Terragrunt?

Not for small setups. It pays off when you deploy the same modules to many environments, accounts or regions and want shared backend and input configuration.

How accurate is Infracost?

It is accurate for fixed-price resources such as instances and databases. Usage-based charges need a usage file, so treat results as estimates and keep cloud budgets in place.

What is the difference between terraform test and Terratest?

terraform test is built into Terraform and uses HCL assertions, often against plans. Terratest is a Go library for end-to-end tests that deploy real infrastructure and check it from outside.

References

What's Your Reaction?

Like Like 0
Dislike Dislike 0
Love Love 0
Funny Funny 0
Angry Angry 0
Sad Sad 0
Wow Wow 0
Mridul I am a passionate technology enthusiast with a strong focus on DevOps, Cloud Computing, and Cybersecurity. Through my blogs at DevOps Training Institute, I aim to simplify complex concepts and share practical insights for learners and professionals. My goal is to empower readers with knowledge, hands-on tips, and industry best practices to stay ahead in the ever-evolving world of DevOps.