Introduction
The currently installed version of Terraform Enterprise may not include support for later Terraform CLI releases whose state format version was not yet known or supported at the time of the Terraform Enterprise Release.
There are specific versions of Terraform CLI bundled in each release of Terraform Enterprise. As an example, Terraform Enteprise v202108-1 added Terraform CLI versions up through 1.0.3
in this release.
Terraform Enterprise administrators are allowed to install more recent versions of Terraform CLI if not included in the Terraform Enterprise release by default. The currently available Terraform CLI versions for a given installation can be found under the workspace General Settings - Terraform Version.
Cause
When Terraform Enterprise workspaces are configured with Sentinel Policy checks, those checks will fail when using Terraform CLI versions 1.0.1 - 1.0.11
or later with a Terraform Enterprise version prior to Terraform Enteprise v202107-1
.
In the Terraform Enterprise v202107-1
release we included support for the 0.2 State Format Version Constraint. This commit was done under a pull request titled - Fixed error running Cost Estimation on Terraform 1.0.1 plans. See release notes.
This is also true for Terraform CLI versions 1.1.0 - 1.1.6
with a Terraform Enterprise version prior to Terraform Enteprise v202111-1
In the Terraform Enterprise v202111-1
release we included support for the the 1.0 State Format Version Constraint. This commit was done under a pull request titled - Added support for terraform-json 0.13.0. See release notes.
The State Format Version for a given Terraform CLI release may be validated with the Terraform CLI command tf show -json
as seen in the example shown below:
badger@badger-C02FH0FHMD6R hulU2 % tf show -json
{"format_version":"1.0","terraform_version":"1.1.6","values":{"root_module":{"resources":[{"address":"null_resource.cluster","mode":"managed","type":"null_resource","name":"cluster","provider_name":"registry.terraform.io/hashicorp/null","schema_version":0,"values":{"id":"2266218645750406959","triggers":null},"sensitive_values":{}}]}}}
See Also - State Format Version Quick Reference Guide:
- Terraform CLI
v0.15.0 - 1.0.0
- State Format Version =0.1
- Terraform CLI
v1.0.1 - 1.0.11
- State Format Version =0.2
- Terraform CLI
v1.1.0 - 1.1.6
- State Format Version =1.0
Solution
If Workspace Terraform CLI version -1.0.1 - 1.0.11
:
Upgrade Terraform Enterprise to the version v202107-1
or later if using Terraform CLI versions 1.0.1 - 1.0.11
in the affected workspace.
If Workspace Terraform CLI version - 1.1.0 - 1.1.6
:
Upgrade Terraform Enterprise to the version v202111-1
or later if using Terraform CLI versions 1.1.0 - 1.1.6
in the affected workspace.
More information on how to upgrade a Terraform Enterprise instance can be found in the official documentation:
https://www.terraform.io/docs/enterprise/admin/upgrades.html
Alternatively you may downgrade the Terraform CLI version if you are unable to upgrade the Terraform Enterprise version due to restriction in your organization or availability of the installation.