terraform plan -out=out.tfstate produces garbage output in the out file. This makes future use of the file (with terraform plan -out or terraform apply -state) unusable.
0.7
core
This is reproducible with any configuration, e.g. resource "null_resource" "dummy" {}
plan succeeds and produces normal output to the console.
Example of resulting out file with the above config:
https://gist.github.com/ajcrites/f0aa95114dac6aaa67c47c33b789710f
out files should be usable by future terraform plan and terraform apply.
Garbage in the out file prevents using it for other terraform commands.
Run terraform plan with the config above
Hi @ajcrites - the -out parameter generates a binary execution plan. This plan file can then be provided as an argument to apply to establish a contract between the reviewed plan and what actually happens during terraform apply.
Here's an example of usage. Given config:
resource "null_resource" "foo" {}
If you run:
terraform plan -out example.tfplan
You'll see as part of the output message:
Your plan was also saved to the path below. Call the "apply" subcommand
with this plan file and Terraform will exactly execute this execution
plan.
Path: example.tfplan
You can then run:
terraform apply example.tfplan
This executes the plan and will bail if anything in the environment changed since the planfile was generated that might invalidate the plan.
I hope this helps to clarify! Let me know if you have any further questions on this.
@ssubraman224 - I am not sure what your comment has to do with this particular issue, which was closed two years ago. Is it possible you meant to comment somewhere else, or create a new issue?
@mildwonkey right, wrong window... typed here by mistake. thanks for notifying.
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.