Menu

1 / 2

Terragrunt run-all

DEV Community·Bartłomiej Danek·6 months ago
#QETD6Dcj
#terraform#terragrunt#hcl#devops#software
Reading 0:00
15s threshold

Terragrunt 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

Enter fullscreen mode

Exit fullscreen mode

dependency-aware ordering

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

Enter fullscreen mode

Exit fullscreen mode

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'

Enter fullscreen mode

Exit fullscreen mode

Detect drift in CI without applying:

# exit code 2 = changes detected, 0 = no changes, 1 = error terragrunt run-all plan \…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.