Introduction
This article provides solutions for a state format version error that occurs during cost estimation operations in Terraform Enterprise when using Terraform CLI version 1.1.0 or newer.
Problem
When using cost estimation in a Terraform Enterprise workspace with Terraform CLI 1.1.0 or later, you may encounter the following error.
unsupported state format version: expected ["0.1" "0.2"], got "1.0"
Cause
Terraform CLI 1.1.0 updated the format_version for the JSON representation of state from "0.2" to "1.0". Support for this new format version was added in Terraform Enterprise v202111-1.
Older versions of Terraform Enterprise do not recognize the "1.0" state format version, which causes the cost estimation feature to fail.
Solutions
There are two primary solutions to resolve this issue.
Solution 1: Upgrade Terraform Enterprise
The recommended solution is to upgrade your Terraform Enterprise instance to version v202111-1 or a more recent version. This ensures compatibility with Terraform CLI 1.1.0 and later, allowing cost estimation to function correctly.
For detailed instructions, refer to the official documentation on Upgrading Terraform Enterprise.
Solution 2: Use an Earlier Terraform CLI Version
If you cannot upgrade Terraform Enterprise due to organizational restrictions, you can use a Terraform CLI version older than 1.1.0 for runs that involve cost estimation. This avoids the state format incompatibility.
Additional Information
This change is documented in the Terraform Enterprise v202111-1 Release Notes under the entry "Added support for terraform-json 0.13.0".