Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

terraform apply -json plan.file: Aligns the plan output to be the same regardless of whether a plan file is used #36245

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

magodo
Copy link
Contributor

@magodo magodo commented Dec 25, 2024

This PR extends for the machine readable UI when applying against a plan file, from only displaying the per resource "planned_change", to be the same as how the plan command displays, which includes:

  • Per resource "planned_change"
  • "change_summary"
  • "outputs" change

This is extreamly useful for toolings that re-use a same logic for processing the apply json outputs, no matter it is ran with a plan file or not.

The PR simply removes the PlannedChange method from the views.Operation interface, as it is only used as an if-like trick for displaying the per resource "planned_change" for json view when applying with plan case. Instead, this PR just type checks the view and reuses the Plan method.

Target Release

1.11.x

Draft CHANGELOG entry

ENHANCEMENTS

  • terraform apply -json plan.file: Aligns the plan output to be the same regardless of whether a plan file is used.

@magodo magodo requested a review from a team as a code owner December 25, 2024 00:19
@magodo magodo changed the title JSON view: Plan summary for applying a plan file terraform apply -json plan.file: Aligns the plan output to be the same regardless of whether a plan file is used Dec 25, 2024
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