Skip to content

Pulumi Engine: plan output missing from PR comments and broken has_changes#575

Open
TheFynx wants to merge 8 commits intoterrateamio:mainfrom
TheFynx:hotfix/pulumi_fixes
Open

Pulumi Engine: plan output missing from PR comments and broken has_changes#575
TheFynx wants to merge 8 commits intoterrateamio:mainfrom
TheFynx:hotfix/pulumi_fixes

Conversation

@TheFynx
Copy link
Copy Markdown
Contributor

@TheFynx TheFynx commented Mar 23, 2026

Fixes two bugs that made the Pulumi engine non-functional with Terrateam

Bug 1: Plan output not displayed in PR comments

diff() returned None, so diff_stdout was always empty and the plan payload contained no output. Now plan() saves the pulumi preview --diff stdout to <plan_file>.diff and diff() reads it back — matching how the Terraform engine provides plan output via terraform show.

Before: (blank plan output in PR comment)

After: (attribute-level diff with GitHub syntax highlighting)

Bug 2: Missing has_changes return value

plan() returned 3 values (success, stdout, stderr) but the runner unpacks 4 (success, has_changes, stdout, stderr), causing a runtime crash on every plan. Now detects changes by checking for Pulumi's change indicators (to create, to update, to delete, to replace) in the preview output.

Additional improvements

  • --diff flag added to pulumi preview for attribute-level output
  • --diff flag added to pulumi up with format_diff() applied so apply output is better formatted/informative - syntax highlighting does not apply here
  • Implemented diff_json(), outputs() which were stubs returning None
  • format_diff() helper moves +/-/~ markers to start-of-line for GitHub ```diff coloring

How to Test

I ran through all these in my setup, but this is how to test the changes directly

  • Trigger a plan — verify PR comment shows preview output with colored diff
  • Trigger an apply — verify output now provides structured created/updated/destroyed list
  • Verify no-op plan correctly reports has_changes=False and doesn't prompt for apply

Before

image

After

No Changes

image

Changes

image

@TheFynx TheFynx requested a review from a team as a code owner March 23, 2026 16:39
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.

1 participant