When upgrading to Terraform 0.13 where runs driven by VCS and state is stored remotely (in this case Terraform Cloud)
I had an issue where a public Github module I was using included versions.tf which fails on older terraform versions.
I'd never used terraform
locally, only connected the repository to Terraform Cloud.
The terraform 0.13upgrade
is only in the 0.13 binaries, I had to download the old binary for my OS and run that specifically.
Even after running the upgrade command, the state still contained the old provider references.
Solution is to connect local terraform to cloud and replace provider.
To local location
I don't know specifically when during this process it should be done.
terraform {
cloud {
organization = "org-name"
workspaces {
name = "workspace-name"
}
}
}
https://releases.hashicorp.com/terraform
..\terraform 0.13upgrade
terraform init
Resolve any issues connecting to Cloud
terraform providers
$ terraform providers
Providers required by configuration:
.
├── provider[registry.terraform.io/hashicorp/aws] ~> 3.0
├── provider[registry.terraform.io/hashicorp/archive] 2.2.0
└── module.main
└── provider[registry.terraform.io/hashicorp/aws] ~> 3.0
Providers required by state:
provider[registry.terraform.io/-/archive]
provider[registry.terraform.io/-/aws]
terraform state replace-provider registry.terraform.io/-/archive registry.terraform.io/hashicorp/archive
hashicorp/archive
Terraform will perform the following actions:
~ Updating provider:
- registry.terraform.io/-/archive
+ registry.terraform.io/hashicorp/archive
Changing 3 resources:
data.archive_file.zipExchangeTravelMoneyOz
data.archive_file.zipStore
data.archive_file.zipExchangeTravelex
Do you want to make these changes?
Only 'yes' will be accepted to continue.
Enter a value: yes
Successfully replaced provider for 3 resources.
Releasing state lock. This may take a few moments...
Triggering run from UI should then be successful, or give you useful errors to fix.