Terraform: 0.12 `show` no longer works without initialization

Created on 5 Jul 2019  路  5Comments  路  Source: hashicorp/terraform

We used to use terraform show to display historical plans so as to allow devs to track changes over time or look back at what changes were applied given a specific build. plan files used to be more portable, where a dev could simply grab a plan file from archives and run terraform show <file> anywhere and it displayed the diff. Now, it appears that plans can only be shown if the a) the config/providers hasn't changed and b) you run from within the properly initialized project. This makes historical plan data useless for us. Is this something we can expect to be resolved in upcoming releases?

Terraform Version

Terraform v0.12.2

Debug Output

Crash Output

Expected Behavior

Plan details should be output in the same format as the plan output (either in the 0.11 or the newer 0.12 format).

Actual Behavior

show either gives the error below, or simply displays a list of resources/modules with question marks.

Error: Saved plan is stale

The given plan file can no longer be applied because the state was changed by
another operation after the plan was created.

Error: Could not satisfy plugin requirements

Plugin reinitialization required. Please run "terraform init".

Plugins are external binaries that Terraform uses to access and manipulate
resources. The configuration provided requires plugins which can't be located,
don't satisfy the version constraints, or are otherwise incompatible.

Terraform automatically discovers provider requirements from your
configuration, including providers used in child modules. To see the
requirements and constraints from each module, run "terraform providers".

Error: provider.vault: new or changed plugin executable

Error: provider.template: new or changed plugin executable

Error: provider.aws: new or changed plugin executable

Error: provider.consul: new or changed plugin executable

Steps to Reproduce

terraform plan -output test.out
terraform init -upgrade (so long as some module or provider updates)
terraform show test.out

References

Related, but not necessarily connected.

  • 21596
  • 21966
cli enhancement

Most helpful comment

Same here, we are using plan output files for deployment so that we can debug if there is an issue - however this renders the files basically unusable after their creation :(

All 5 comments

Hi @plukevdh,

Thanks for opening this issue! As you've seen, the show command changed quite a bit for terraform 0.12, and while we had not planned on making it work with old plan files (or outside of an initialized terraform configuration directory), I will flag this as an enhancement so we can take a look.

This isn't going to help with your historical plan data, but as a workaround for terraform 0.12 plans (and state)s, you can save your plan in json format by running terraform show -json tf.plan > plan.json - that gives you a json object you can save and parse later.

This has just bitten us as well. Would be really nice if the plan output wouldn't need a fully initialized project and therefore credentials as well.

Same here, we are using plan output files for deployment so that we can debug if there is an issue - however this renders the files basically unusable after their creation :(

Strong +1 to everything above. Would be a great help with out automation and testing.

We would very much like to be able to terraform show a stale plan; this comes up for us when two people are working on the same Terraform environment, each of them has generated a plan, and put in a pull request for their config changes, and gotten approval, and one goes first. Before, when the second went to apply, they'd get an error, and could show their old plan, generate a new plan, and diff the two to make sure nothing unexpected had changed. Now, we can't show the old plan, so it's harder to be confident that no unexpected changes have crept in.

Was this page helpful?
0 / 5 - 0 ratings