Skip to content

fix: Preserve failed Terraform plan diagnostics - #2770

Open
frank-bee wants to merge 1 commit into
diggerhq:developfrom
frank-bee:fix/2761-terraform-plan-errors
Open

frank-bee wants to merge 1 commit into
diggerhq:developfrom
frank-bee:fix/2761-terraform-plan-errors

Conversation

@frank-bee

Copy link
Copy Markdown

Closes #2761.

Failed Terraform plans currently discard their captured stdout/stderr, leaving an empty PR comment titled Error during init.. Preserve both output streams on failure in Terraform and OpenTofu, and label Terraform error comments with the actual failing step (plan, show, or init). Successful plans and detailed exit code 2 keep their existing behavior.

AI assistance disclosure: Codex generated the implementation, regression tests, and this description, and ran the local validation.

Tests exercise both CLI adapters with exit codes 0, 1, and 2, and check the rendered error comments through DiggerExecutor with both Markdown and plain formatting. The new tests reproduce the missing output and incorrect titles on the original code.

Validation:

  • Full libs suite passed: CI=true IS_EXTERNAL_PR=true DIGGER_TEST_USE_REAL_SA=0 go test ./... -count=1, with a local Azurite table service.
  • go vet ./execution ./comment_utils/reporting passed.
  • Local toolchain: Go 1.27.2, Terraform 1.16.6, OpenTofu 1.8.5, darwin/arm64.
  • Live-cloud, licensed, and authenticated GitHub integration tests use the repository's standard CI/external-contributor skips. The GitHub Actions demo was not run.

This branch has not been deployed

No deployments
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.

Failed terraform plan shows empty "Error during init." comment

1 participant