Technology Apr 15, 2026 · 1 min read

Terragrunt run-all

run-all Runs a Terraform command across all units in the current directory tree, respecting dependency order. cd environments/prod terragrunt run-all plan terragrunt run-all apply terragrunt run-all destroy # reverse order dependency-aware ordering environments/pr...

DE
DEV Community
by Bartłomiej Danek
Terragrunt run-all

run-all

Runs a Terraform command across all units in the current directory tree, respecting dependency order.

cd environments/prod
terragrunt run-all plan
terragrunt run-all apply
terragrunt run-all destroy   # reverse order

dependency-aware ordering

environments/prod/
├── vpc/
├── rds/          # depends on vpc
└── eks/          # depends on vpc

run-all apply applies vpc first, then rds and eks in parallel.

real CI pipeline

# .github/workflows/deploy.yml
- name: Plan all
  run: terragrunt run-all plan --terragrunt-non-interactive
  working-directory: environments/prod

- name: Apply all
  run: terragrunt run-all apply --terragrunt-non-interactive -auto-approve
  working-directory: environments/prod
  if: github.ref == 'refs/heads/main'

Detect drift in CI without applying:

# exit code 2 = changes detected, 0 = no changes, 1 = error
terragrunt run-all plan \
  --terragrunt-non-interactive \
  -detailed-exitcode

filtering

# skip a unit
terragrunt run-all apply --terragrunt-exclude-dir environments/prod/rds

# target a single unit and its dependencies
terragrunt run-all apply --terragrunt-include-dir environments/prod/eks

parallelism

# default is unlimited parallel - cap it if you hit API rate limits
terragrunt run-all apply --terragrunt-parallelism 4

output

Each unit prefixes its own output:

[environments/prod/vpc] Apply complete! Resources: 12 added.
[environments/prod/rds] Apply complete! Resources: 4 added.
[environments/prod/eks] Apply complete! Resources: 31 added.

Originally published at https://bard.sh/posts/terragrunt_run_all/

DE
Source

This article was originally published by DEV Community and written by Bartłomiej Danek.

Read original article on DEV Community
Back to Discover

Reading List