All field notesBook a 30-min call

Terragrunt Plan Slow? How We Cut a 17-Minute Plan to 61 Seconds

A production Terragrunt plan spent 16 of its 17 minutes resolving dependency outputs. Dropping redundant init and reading outputs from GCS state brought it to 61 seconds.

A production Terragrunt plan for one web stack took 17 minutes in CI. The plan itself, refreshing state and computing changes, took 13 seconds. Everything else was overhead.

That kind of delay changes behavior. Engineers batch infrastructure changes to avoid the wait, reviews stall on plans, and small fixes start to feel expensive.

Read the timestamps

The build log showed where the time went:

  • terragrunt init resolving dependency outputs: about 8.3 minutes
  • terragrunt plan resolving the same outputs again: about 7.9 minutes
  • actual refresh and plan: about 13 seconds

Two problems were stacked. The pipeline ran an explicit init before plan, and both resolved the full dependency tree. For every dependency block, Terragrunt also ran terraform init and terraform output to read upstream values, which adds up quickly across a deep tree.

Three small changes

  1. Drop the redundant init. plan and apply initialize on their own. Removing the explicit step halved the dependency work by itself.
  2. Read outputs from state. Terragrunt can read dependency outputs straight from remote state instead of initializing each upstream module and running terraform output. Enable it with --dependency-fetch-output-from-state (or TG_DEPENDENCY_FETCH_OUTPUT_FROM_STATE=true in CI):
export TG_DEPENDENCY_FETCH_OUTPUT_FROM_STATE=true
terragrunt plan

The version in use only supported this for S3, and this platform's state lived in Google Cloud Storage. Upgrading Terragrunt from 0.81 to 1.1.6 added GCS support. 3. Retire Atlantis. Plans already ran as Cloud Build jobs triggered from GitHub Actions, so the Atlantis server in the runner image was dead weight. The new image is a small Alpine base with Terraform, Terragrunt, and the few tools the build step needs.

Each change shipped separately with a rollback path. The runner image is pinned by digest, so the new image took effect when one line changed, and reverting that line restores the old one.

The result

StackBeforeAfterSpeedup
Production web stack17m10s61s~17×
Production scheduling service5m52s66s~5×

The new plans matched what the old image produced, including two pre-existing drift items. The speedup changed how long plans take, not what they say.

What carries over

  • Read build timestamps before tuning anything. The answer was in the log, not in a bigger machine.
  • Version drift has a cost. The feature that mattered already existed. The pinned version was too old to use it with this backend.
  • Fast feedback changes behavior. When a plan takes a minute, engineers make smaller changes, reviews move faster, and drift gets caught earlier.

Slow infrastructure pipelines are rarely slow everywhere. Find the step doing the same work twice, and make it do that work once.