Summary
There are certain scenarios in which it becomes necessary to downgrade the version of the Terraform command line tool used by Terraform Cloud or Terraform Enterprise (TFC/E).
- Provider compatibility requirements
- Inadvertently upgraded
In workspaces that have already run on a higher version, you must manually modify the state file to allow for downgrading. This is a guide for doing that between Terraform versions 0.14.x and 1.0.x only.
Steps
- Follow the steps at Using the remote backend and Terraform CLI to run plan and state operations locally. For step #7 in that guide, instead modify the Terraform Version setting to match the version you are downgrading to. At your local CLI, make sure that your Terraform version matches the desired downgraded version as well. All Terraform CLI releases can be found here.
- In the target Workspace in TFC/E, navigate to the "States" tab, select the latest state record, and download the state file to the local directory containing your Terraform configuration.
- Open the state file in a text editor and increment the `serial` value by 1, e.g. a `git diff` on the file might show:
{
"version": 4,
"terraform_version": "1.0.2",
- "serial": 3,
+ "serial": 4,
... - Run the
terraform state push
command with the-ignore_remote_version
option targeting the just-modified state file to upload to the target Workspace. If the file name issv-zzz.tfstate
, this command would look liketerraform state push -ignore_remote_version ./sv-zzz.tfstate
.