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 that process.
- 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:
- "serial": 3,
+ "serial": 4,
- Run the
terraform state pushcommand with the
-ignore_remote_versionoption targeting the just-modified state file to upload to the target Workspace. If the file name is
sv-zzz.tfstate, this command would look like
terraform state push -ignore_remote_version ./sv-zzz.tfstate.