Terraform Advanced — Terragrunt run-all Commands

less than 1 minute read

Apply, plan, or destroy an entire environment in dependency order with one command.


run-all Commands

# Plan all stacks in prod/
$ cd environments/prod
$ terragrunt run-all plan

# Apply all stacks in dependency order
$ terragrunt run-all apply

# Destroy in reverse dependency order
$ terragrunt run-all destroy

Execution Order

Terragrunt builds a dependency graph and executes in order:

$ terragrunt run-all apply

Group 1 (no dependencies):  vpc
Group 2 (depends on vpc):   security, rds
Group 3 (depends on 1+2):   eks
Group 4 (depends on eks):   application
Group 5 (depends on app):   dns

Filtering

# Only run specific stacks
$ terragrunt run-all apply \
    --terragrunt-include-dir "*/vpc" \
    --terragrunt-include-dir "*/eks"

# Exclude stacks
$ terragrunt run-all plan \
    --terragrunt-exclude-dir "*/dns"

# Limit parallelism
$ terragrunt run-all apply --terragrunt-parallelism 2

What’s Next?

Practice Terragrunt patterns.

← Dependency Blocks Practice Exercises →

Updated: