Skip to main content


Terragrunt projects are automatically detected when passed in via the --path flag:

# Show breakdown of costs
infracost breakdown --path=path/to/terragrunt/code

# Show diff of costs
infracost diff --path=path/to/terragrunt/code

Terragrunt CLI Options

Terragrunt CLI flags can be passed through the INFRACOST_TERRAGRUNT_FLAGS environment variable:

INFRACOST_TERRAGRUNT_FLAGS="--terragrunt-exclude-dir dev" infracost breakdown --path /path/to/terragrunt/code

The above can be used in addition to Terragrunt environment variables, e.g. TERRAGRUNT_PARALLELISM=4 infracost breakdown --path=....

Usage file

If your Terragrunt project has multiple modules and you want to specify different usage files for each module, you will need to add each Terragrunt subdirectory and usage file to the Infracost config file, see an example here.

If you have any feedback about how we should support multiple usage files with Terragrunt in the future, please comment on or follow this issue.


The infracost/infracost Docker image (Dockerfile) has the latest stable version of Terragrunt.

By default, that Dockerfile uses Terraform 0.15.5, but you can set the environment variable TERRAGRUNT_TFPATH to any of the supported versions so Terragrunt uses that version, e.g. TERRAGRUNT_TFPATH=terraform_1.0.

How the Terragrunt integration works

  1. Infracost detects a Terragrunt project by checking for a Terragrunt config file in the specified path, which will be terragunt.hcl, terragrunt.hcl.json or the value of the TERRAGRUNT_CONFIG environment variable. If Infracost does not detect your project as a Terragrunt project, make sure this file exists in the specified path or in any of the subdirectories with a depth less than 5.
  2. If Terragrunt is detected Infracost runs terragrunt run-all plan -out <tmpfile> against the directory to generate plan files for all projects. We use the --terragrunt-ignore-external-dependencies flag to limit the cost estimate to only include infrastructure defined in the current directory.
  3. Infracost loops through all the Terragrunt modules and runs terragrunt show <tmpfile> for each. This currently does not use the terragrunt run-all functionality since it's not possible to match the output from that to a specific module.
  4. Infracost outputs a diff or breakdown for each Terragrunt module.

Migrating from pre v0.9.7 Infracost CLI

Pre v0.9.7 Infracost did not have native support for Terragrunt. Old configurations will still work, but can now be simplified.

  • You no longer need to set INFRACOST_TERRAFORM_BINARY to terragrunt unless you are using a non-standard binary path.
  • You no longer need to specify multiple Terragrunt modules in your Infracost config file, unless you want to specify per-project usage. Infracost will now detect all the Terragrunt modules that exist under the specified --path.
  • The Terragrunt and will be deprecated and will no longer be maintained. The functionality provided by these is now supported within the Infracost binary.