Skip to content
Latchkey

terragrunt init: Initialize a Terragrunt Unit

terragrunt init runs terraform init after generating backend, provider, and remote-state config from your terragrunt.hcl.

Terragrunt is a thin wrapper over Terraform that keeps backend and provider config DRY. init is where it materializes the generated files before delegating to terraform.

What it does

terragrunt init resolves the terragrunt.hcl for the current directory, downloads the module named in terraform { source = ... } into a .terragrunt-cache folder, writes any generated files (backend block from remote_state, plus generate blocks), then runs terraform init inside that cache. Most other Terragrunt commands auto-init, so you rarely run it alone.

Common usage

Terminal
terragrunt init
# force a backend reconfigure (passes through to terraform)
terragrunt init -reconfigure
# init without touching the remote backend
terragrunt init -backend=false

Options

FlagWhat it does
-reconfigurePassed through to terraform init to reconfigure the backend
-backend=falseSkip backend initialization
--terragrunt-working-dir <dir>Run as if invoked from this directory
--terragrunt-source <path>Override the module source (useful for local dev)
--terragrunt-log-level <level>debug, info, warn, error

In CI

Terragrunt auto-runs init before plan/apply, so an explicit init step is usually redundant. If you cache .terragrunt-cache, key it on the lockfile and the source URL. The newer CLI redesign renames --terragrunt-* flags to --* (for example --working-dir); pin your Terragrunt version so flag names stay stable across runners.

Common errors in CI

"Error: Initialization required. Please see the error message above." usually means a stale .terragrunt-cache; delete it and re-run. "Could not download remote module" with a Git error means the source URL or a private-repo token is wrong. "Error finding terragrunt.hcl" means you are not in a unit directory or --terragrunt-working-dir points at the wrong path.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →