hashicorp / hashicorp/terraform-exec

Add error types for state/planfile version incompatibility

Open
#58 0 comments 0 reactions 1 assignee Claimed by @kmoe View on GitHub
enhancement
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.