Skip to content

Units

A unit is configured in a terragrunt.hcl file in the unit’s directory, e.g.:

terragrunt.hcl
include "root" {
path = find_in_parent_folders("root.hcl")
}
dependencies {
paths = ["../vpc", "../mysql", "../redis"]
}

Terragrunt also reads JSON-serialized HCL from terragrunt.hcl.json files. Wherever the docs mention terragrunt.hcl, a terragrunt.hcl.json file works too.

Terragrunt uses the first of these as a unit’s configuration file:

  1. The file the --config flag names.
  2. The file the TG_CONFIG environment variable names.
  3. A terragrunt.hcl file in the current working directory.
  4. A terragrunt.hcl.json file in the current working directory.

If none of them exists, Terragrunt exits with an error.

NameDescription
catalogConfigures the module catalogs that the catalog and scaffold commands read.
expansionGenerates one instance of a dependency, unit, or stack block per element of a collection.
remote_stateConfigures the OpenTofu/Terraform backend that stores a unit's state.
terraformConfigures where Terragrunt gets the OpenTofu/Terraform module and how it runs tofu or terraform.

The Blocks page documents the blocks not listed here.

NameDescription
download_dirOverrides the directory Terragrunt downloads OpenTofu/Terraform modules into.
iam_assume_role_durationSets the STS session duration, in seconds, for the IAM role Terragrunt assumes.
iam_assume_role_session_nameSets the STS session name for the IAM role Terragrunt assumes.
iam_roleSets the IAM role Terragrunt assumes before invoking OpenTofu/Terraform.
iam_web_identity_tokenSets the web identity token, or the path to it, for assuming iam_role with AssumeRoleWithWebIdentity.
inputsSets the input variables Terragrunt passes to OpenTofu/Terraform.
prevent_destroyStops the destroy and run --all destroy commands from destroying a unit's resources.
terraform_binaryOverrides the OpenTofu/Terraform binary Terragrunt calls.
terraform_version_constraintSets the OpenTofu/Terraform versions a unit accepts.
terragrunt_version_constraintSpecifies which versions of the Terragrunt CLI can be used with your configuration.
NameDescription
get_envReturns the value of an environment variable.

The Functions page documents the functions not listed here.