Legacy Terraform Providers local and template on Apple Silicon
I manage multiple projects and After migrating to an Apple Silicon laptop I realized that one of the projects still uses template
and local
providers which have been long deprecated by now.
Issue
When running a native arm terrafrom init
I was getting this error:
╷
│ 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.
╵
Root Cause
It’s happening because hashicorp/template is deprecated but some old module still uses it but terraform can’t find arm-based binary.
Fix Attempt 1: Rosetta all the way
I saw posts about making my own provider build, but I needed a quick solution since there was a change needed too this project.
At first I just though I’ll just get x86 terraform installed and run everything in rosetta mode. Sadly it didn’t work well as it was dreadfully slow and then it just got stuck. (Not sure if this is normal though). Looked kinda like this:
^CStopping operation...
Interrupt received.
Please wait for Terraform to exit or data loss may occur.
Gracefully shutting down...
^C
Two interrupts received. Exiting immediately. Note that data loss may have occurred.
Releasing state lock. This may take a few moments...
╷
│ Error: operation canceled
│
│
╵
^C
Solution
The solution is to use most of the arm64 terraform and most of providers, but use amd64 providers that are deprecated or not supported.
Let’s
- Get amd64-based terraform
- Install all providers
terraform init
- Rename or copy amd-based providers
- Get arm-based terraform