Skip to content

fix: treat terragrunt run --all plan as hasPlanStep to skip single-file terraform show - #2655

Open
ramkalapala wants to merge 1 commit into
diggerhq:developfrom
ramkalapala:fix/skip-plan-postprocessing-run-all
Open

ramkalapala wants to merge 1 commit into
diggerhq:developfrom
ramkalapala:fix/skip-plan-postprocessing-run-all

Conversation

@ramkalapala

Copy link
Copy Markdown

Fixes #2552

Problem

When using terragrunt run --all plan via a custom run step in the
workflow, driftctl scan completes successfully but then fails with:
error running terraform show: exit status 1

Root Cause

hasPlanStep in libs/execution/execution.go is only set to true
when a step has action == "plan":

hasPlanStep := lo.ContainsBy(planSteps, func(step scheduler.Step) bool {
    return step.Action == "plan"
})

With a custom run step, hasPlanStep stays false. After the run
step completes successfully, Digger falls into the !hasPlanStep branch
and calls terraform show against LocalPlanFilePath() — expecting a
single .tfplan file. But terragrunt run --all plan writes per-module
plan files across subdirectories, not a single file at that path.

Fix

Extend the hasPlanStep check to also treat run steps containing
run --all plan as a plan step, skipping the single-file
terraform show post-processing:

hasPlanStep := lo.ContainsBy(planSteps, func(step scheduler.Step) bool {
    return step.Action == "plan" ||
        (step.Action == "run" && strings.Contains(step.Value, "run --all plan"))
})

No new imports required — strings is already imported.

Testing

Existing test suite unchanged. Fix only affects workflows using
terragrunt run --all plan via a custom run step.

@ramkalapala

Copy link
Copy Markdown
Author

Hi team, raised this PR to address #2552, @s1ntaxe770r, would really appreciate a review and approval when you get a chance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support terragrunt run --all

1 participant