Hi guys, recently I was struggling against version incompatible problem between local environment and terraform version, which gave me a good lesson learn. I really want to share with you all who are exploring on Terraform.
I’m working on an OLD terraform project that deploys AWS resources. For some historical reason, the required terraform version is 1.3.4. And my laptop is Mac Air M2. As the M2 OS is arm64, I installed * terraform_1.3.4_darwin_arm64.zip on Mac, but failed to install providers with below error messages when running “terraform init”. However, I did found the darwin_arm64 version for all providers except for template which is deprecated officially. Anyway, as my understanding, it should install these providers that has an available darwin_arm64 release(version) successfully.
Finally, I found a workaround which is surprised me and confused me as well. I reinstalled terraform v1.3.4_darwin_amd64 instead of v1.3.4_darwin_arm64, and all providers got installed successfully, of course amd64 version.
It never enter my mind that if I can try another terraform version on Mac OS. Terraform provides a list of zip files for almost all OS for each version, like Terraform v1.3.4 Binaries | HashiCorp Releases , it gives me a sense that your OS is linux, you go linux, if your OS is windows, you take windows, for me, of course, it’s arm64.
Sometimes, we have to break our thinking set and try something that may be crazy. Then you will find a solution…
this backend unless the backend configuration changes.
Initializing provider plugins...
- terraform.io/builtin/terraform is built in to Terraform
- Reusing previous version of hashicorp/local from the dependency lock file
- Reusing previous version of hashicorp/archive from the dependency lock file
- Reusing previous version of hashicorp/null from the dependency lock file
- Reusing previous version of hashicorp/aws from the dependency lock file
- Reusing previous version of hashicorp/template from the dependency lock file
- Installing hashicorp/local v2.2.3...
- Installed hashicorp/local v2.2.3 (signed by HashiCorp)
╷
│ Warning: Version constraints inside provider configuration blocks are deprecated
│
│ on providers.tf line 5, in provider "aws":
│ 5: version = "~> 2.62"
│
│ Terraform 0.13 and earlier allowed provider version constraints inside the provider configuration block, but that is now deprecated and will be removed in a future version of Terraform. To silence this warning, move the
│ provider version constraint into the required_providers block.
│
│ (and 4 more similar warnings elsewhere)
╵
╷
│ Error: Incompatible provider version
│
│ Provider registry.terraform.io/hashicorp/aws v2.70.1 does not have a package available for your current platform, darwin_arm64.
│
│ Provider releases are separate from Terraform CLI releases, so not all providers are available for all platforms. Other versions of this provider may have different platforms supported.
╵
╷
│ Error: Incompatible provider version
│
│ Provider registry.terraform.io/hashicorp/template v2.2.0 does not have a package available for your current platform, darwin_arm64.
│
│ Provider releases are separate from Terraform CLI releases, so not all providers are available for all platforms. Other versions of this provider may have different platforms supported.
╵
╷
│ Error: Incompatible provider version
│
│ Provider registry.terraform.io/hashicorp/archive v1.3.0 does not have a package available for your current platform, darwin_arm64.
│
│ Provider releases are separate from Terraform CLI releases, so not all providers are available for all platforms. Other versions of this provider may have different platforms supported.
╵
╷
│ Error: Incompatible provider version
│
│ Provider registry.terraform.io/hashicorp/null v2.1.2 does not have a package available for your current platform, darwin_arm64.
│
│ Provider releases are separate from Terraform CLI releases, so not all providers are available for all platforms. Other versions of this provider may have different platforms supported.
╵
╷
│ Error: Required plugins are not installed
│
│ The installed provider plugins are not consistent with the packages selected in the dependency lock file:
│ - registry.terraform.io/hashicorp/aws: there is no package for registry.terraform.io/hashicorp/aws 2.70.1 cached in .terraform/providers
│ - registry.terraform.io/hashicorp/local: the cached package for registry.terraform.io/hashicorp/local 2.2.3 (in .terraform/providers) does not match any of the checksums recorded in the dependency lock file
│ - registry.terraform.io/hashicorp/null: there is no package for registry.terraform.io/hashicorp/null 2.1.2 cached in .terraform/providers
│ - registry.terraform.io/hashicorp/template: there is no package for registry.terraform.io/hashicorp/template 2.2.0 cached in .terraform/providers
│ - registry.terraform.io/hashicorp/archive: there is no package for registry.terraform.io/hashicorp/archive 1.3.0 cached in .terraform/providers
│
│ Terraform uses external plugins to integrate with a variety of different infrastructure services. To download the plugins required for this configuration, run:
│ terraform init