hashicorp / hashicorp/terraform-exec
Add error types for state/planfile version incompatibility
- Dominant language
- Go
- Stars
- 786
- Forks
- 129
- PR merge metrics
- No merged PRs in 30d
Description
There is a class of CLI errors of the form:
```
Error: Invalid plan file
Failed to read plan from plan file: plan file was created by Terraform
0.12.29, but this is 0.13.0; plan files cannot be transferred between
different Terraform versions.
```
Handle all these cases with well-known error types:
- Plan file created by different version
- State file created by later version
- State file created by 0.12 without explicit backend configuration and with a name other than "terraform.tfstate", and accessed in 0.13 https://github.com/hashicorp/terraform/issues/25920
The only "format_version" presently known by terraform-json and this library is 0.1. Add at least an e2e test that will flag if another version is encountered. There's no need to error at _runtime_ unless and until the Terraform CLI does so.
Contributor guide
Assessment
This issue has not been assessed yet.