Reputation: 1
I'm using Google CLoud Console to run terraform Scrit, I found that Cloud shell is already equiped with Terrafrom version 12.. My Google resources is only supported for Terraform version 11.. How do I downgrade Terraform from Version 12 to 11 in Google CLoud Shell
Upvotes: 0
Views: 6655
Reputation: 336
The easiest way to manage your Terraform versions is the tfswitch tool. You can install it from here: tfswitch
Usage
|--⫸ tfswitch
Use the arrow keys to navigate: ↓ ↑ → ←
? Select Terraform version:
▸ 0.11.12 *recent
0.11.13 *recent
0.11.14 *recent
0.12.19
↓ 0.12.18
Upvotes: 2
Reputation: 45263
running all terraform commands in container hashicorp/terraform:0.11.14
, that's what I am doing currently for old project. so it has no chance to upgrade terraform version any more in container.
TERRAFORM_IMAGE=hashicorp/terraform:0.11.14
TERRAFORM_CMD="docker run -ti --rm -w /app -v ${HOME}/.aws:/root/.aws -v ${HOME}/.ssh:/root/.ssh -v `pwd`:/app -w /app ${TERRAFORM_IMAGE}"
${TERRAFORM_CMD} init
${TERRAFORM_CMD} plan
Second, make sure you limit the terraform version in your codes. If not, you have the risk to run terraform with higher version (>0.12) and get tfstate
file upgraded directly. It will be hard to roll back, unless you enable the version control when save *tfstate
files.
terraform {
required_version = "<= 0.11.14"
}
Upvotes: 2