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

Add options to terraform show to have parity with terraform plan output #21596

Closed
devonbleak opened this issue Jun 4, 2019 · 4 comments
Closed

Comments

@devonbleak
Copy link
Contributor

Current Terraform Version

$ terraform -version
Terraform v0.12.1
+ provider.aws v2.13.0

Use-cases

I'd like to have a way for terraform show to display the additional information that we get from a terraform plan to do quick sanity checks on the plans without having to re-run them.

Currently there are 3 major differences in terraform plan vs terraform show output:

  1. The summary line (Plan: X to add, Y to change, Z to destroy) is only present in terraform plan output
  2. terraform plan shows additional details about the resources it's changing and why
  3. terraform show displays a ? status for resources that the plan doesn't touch

Attempted Solutions

Looked at terraform show -help. This could be solvable by piping JSON output into a separate process to produce the desired output but it seems TF should already have the code available for this since it exists for terraform plan

Proposal

Proposing the following additions to terraform show (and definitely open to shorter/better suggestions on the names of the flags):

  1. -summarize would add the summary line display
  2. -verbose would add the additional details regarding the changes to resources
  3. -changed-only would suppress output for resources that aren't changing

And/or -plan to just completely mimic terraform plan output and save some typing.

References

@apparentlymart
Copy link
Contributor

Hi @devonbleak! Thanks for requesting this.

We noticed shortly after the 0.12.0 release that the terraform show command didn't get all of the same updates terraform plan did for the new plan rendering, which is why its output seems pretty "degraded" compared to terraform plan: it's mostly based on the v0.11 implementation, with some partial shims.

We do intend to update it to use the same rendering codepath as terraform plan does, though we don't have plans to make it have any additional options compared to the normal plan output... we might do that in a separate change later, but output parity is the first goal.

That it shows resources that aren't changing is a bug and it should be fixed as part of switching to the new codepath. That arises because the Terraform v0.12 plan format includes all of the resources but the unchanged ones are filtered out during display, whereas the old v0.11 format (which the terraform show command is currently expecting) had them pre-filtered.

@devonbleak
Copy link
Contributor Author

Hi @apparentlymart - thanks for the speedy response!

Your existing plan/prioritization sounds good.

The only thing I would add is that in 0.11 the terraform show output also did not include the summary line, so would just want to be sure it's either included by default or there's a new option to include it. Thanks!

@apparentlymart
Copy link
Contributor

This was addressed in #23292. The change should be included in the next minor release.

The output from terraform show with a saved plan will match the output produced by terraform plan when it originally saved that plan, including the summary information.

@ghost
Copy link

ghost commented Mar 29, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Mar 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants