TerragruntCLI icon
SlackIncomingWebhook icon

Plan an Entire Terragrunt Estate with run-all in One Execution

Run terragrunt run-all plan across every unit of a live infrastructure repo with Kestra, keep the plan log as an artifact, and post a Slack summary.

Categories
Infrastructure

See the whole estate's pending changes in one execution. Terragrunt mono-repos split infrastructure into many small units, which keeps blast radius low but makes "what would change right now" a question that spans dozens of folders. This blueprint answers it with a single io.kestra.plugin.terragrunt.cli.TerragruntCLI task: terragrunt run-all plan walks every unit under the live folder, resolves the dependency graph, plans each unit, and the flow keeps the combined log as an execution artifact and posts a Slack summary.

The demo ships a miniature but structurally faithful repository inline through inputFiles: a root.hcl with shared inputs, two units (live/network and live/app) that include it, and two local modules that only create local_file resources, so the flow runs end to end without any cloud credentials.

How it works

  1. plan_estate (io.kestra.plugin.terragrunt.cli.TerragruntCLI) materializes the repository layout from inputFiles into the task working directory. The terragrunt binary is on the PATH inside the task container, and the underlying terraform binary ships with the alpine/terragrunt image.
  2. terragrunt run-all plan --non-interactive --working-dir live discovers both units, includes the shared root.hcl in each, and plans them in dependency order. The output is captured to plan.log and echoed to the task log.
  3. The task counts the units it covered with find and emits the number through Kestra's outputs protocol, so it is available as {{ outputs.plan_estate.vars.units }}.
  4. The exit code of the plan is preserved: the flow still fails when any unit fails to plan, but only after the log has been captured.
  5. notify posts the unit count to Slack, and the errors block posts a distinct alert when the plan fails anywhere in the estate.

What you get

  • One execution that shows pending changes for every unit instead of a folder-by-folder crawl.
  • The complete run-all plan log stored as a downloadable artifact on the execution.
  • A unit count emitted as a first-class flow output, ready for thresholds or downstream tasks.
  • A repository layout you can replace wholesale with your real repo via namespaceFiles or a Git clone.

Who it's for

  • Platform teams running Terragrunt mono-repos who want a scheduled, auditable answer to "what has changed underneath us".
  • Infrastructure engineers reviewing estate-wide impact before a promotion or a provider upgrade.
  • Anyone evaluating the Terragrunt plugin who wants a runnable example with zero cloud setup.

Why orchestrate this with Kestra

Running run-all plan from a laptop produces a wall of text that disappears with the terminal session. Kestra turns the same command into a governed operation: the log becomes a stored artifact, the unit count becomes structured output, Slack gets a summary, failures raise a distinct alert, and every run is preserved in the execution history so you can compare this week's estate against last week's.

Prerequisites

  • A Slack incoming webhook for summaries and failure alerts.
  • No cloud credentials are needed for the demo, the modules only create local files. For a real estate, pass provider credentials through the task env from {{ secret('...') }}.

Secrets

  • SLACK_WEBHOOK_URL: Slack incoming webhook URL.

Quick start

  1. Add the SLACK_WEBHOOK_URL secret to your Kestra namespace.
  2. Execute the flow and open plan.log in the execution outputs to see both units planned.
  3. Check the Slack message reports 2 units.

How to extend

  • Replace the inline inputFiles with namespaceFiles so the task mounts your real infrastructure repository from namespace storage, or clone it with io.kestra.plugin.git.Clone inside a WorkingDirectory task.
  • Switch the underlying binary to OpenTofu by using a container image that ships tofu and setting the TERRAGRUNT_TFPATH environment variable through the task env.
  • Add a Schedule trigger to run the estate-wide plan every morning, as shown in the Terragrunt drift watch blueprint.
  • Scope the plan to one environment folder with --working-dir, as shown in the Terragrunt environment promotion blueprint.

Links

Orchestrate with Kestra
Orchestrate Slack with Kestra
Share this Blueprint
See How

New to Kestra?

Use blueprints to kickstart your first workflows.