Pulumi Engine: plan output missing from PR comments and broken has_changes#575
Open
TheFynx wants to merge 8 commits intoterrateamio:mainfrom
Open
Pulumi Engine: plan output missing from PR comments and broken has_changes#575TheFynx wants to merge 8 commits intoterrateamio:mainfrom
TheFynx wants to merge 8 commits intoterrateamio:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes two bugs that made the Pulumi engine non-functional with Terrateam
Bug 1: Plan output not displayed in PR comments
diff()returnedNone, sodiff_stdoutwas always empty and the plan payload contained no output. Nowplan()saves thepulumi preview --diffstdout to<plan_file>.diffanddiff()reads it back — matching how the Terraform engine provides plan output viaterraform show.Before: (blank plan output in PR comment)
After: (attribute-level diff with GitHub syntax highlighting)
Bug 2: Missing
has_changesreturn valueplan()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
--diffflag added topulumi previewfor attribute-level output--diffflag added topulumi upwithformat_diff()applied so apply output is better formatted/informative - syntax highlighting does not apply herediff_json(),outputs()which were stubs returningNoneformat_diff()helper moves+/-/~markers to start-of-line for GitHub```diffcoloringHow to Test
I ran through all these in my setup, but this is how to test the changes directly
has_changes=Falseand doesn't prompt for applyBefore
After
No Changes
Changes