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

The show command should warn, not fail, if the plan is stale. #30269

Closed
nl-brett-stime opened this issue Dec 27, 2021 · 4 comments
Closed

The show command should warn, not fail, if the plan is stale. #30269

nl-brett-stime opened this issue Dec 27, 2021 · 4 comments

Comments

@nl-brett-stime
Copy link

nl-brett-stime commented Dec 27, 2021

Sometimes it's useful to see what the changes related to a give plan were even after it's been applied. When using the show command on a stale plan, ideally Terraform would report a warning and continue to show the plan instead of reporting an error and terminating. Alternately, maybe add an option to ignore staleness. E.g., terraform show -ignore-stale -json some.tfplan

Terraform Version

Tested in v1.0.11 but probably applies to more recent versions as well.

Terraform Configuration Files

Any config

Debug Output

Expected Behavior

<shows plan or plan JSON>
<outputs *warning* in yellow, maybe to stderr, that plan is stale>

Actual Behavior

(red error message): Saved plan is stale
<program terminates>

Steps to Reproduce

  1. terraform init
  2. terraform plan -out some.tfplan
  3. terraform apply some.tfplan
  4. terraform show -json some.tfplan

Additional Context

References

@nl-brett-stime nl-brett-stime added bug new new issue not yet triaged labels Dec 27, 2021
@alisdair
Copy link
Contributor

alisdair commented Jan 4, 2022

Hi @nl-brett-stime, thanks for submitting this. There's some related work happening in #30205, fixing #30195, and I believe that what you're describing here may already be fixed in the 1.1 series. Could you check if 1.1.2 resolves the issue for you?

@alisdair alisdair added the waiting-response An issue/pull request is waiting for a response from the community label Jan 4, 2022
@dominics
Copy link

dominics commented Jan 16, 2022

Shouldn't that be 1.1.3 to check? (if we're checking for #30205 - the changelog indicates that's when it was released) - and thanks for your work @alisdair!

#28136 seems like another duplicate that might be fixed, which is excellent (and my CI/CD scripts have been experiencing this stale plan warning for a few years - there's no good way to get at the JSON for an applied plan otherwise - so I'm really happy about this potential fix)

@alisdair
Copy link
Contributor

alisdair commented Jan 17, 2022

Ah, yes, thanks for the correction!

I've just verified that this is fixed in Terraform 1.1.3, so I'm closing this and the other issue accordingly.

@crw crw removed waiting-response An issue/pull request is waiting for a response from the community new new issue not yet triaged labels Jan 19, 2022
@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 18, 2022
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

4 participants