Building Terraform Stuff
I went and bought myself one of those new Macbook Air laptops that have the Darwin/ARM64 processros in them. Not done too much devving on it other than a bit of terraform. And recently I was doing some farily basic stuff from the book “Terraform Up And Running” when I came across an error which was both confusing and annoying for hte same reason: I had changed seemingly nothing when it occured:
│ 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. │
OK, what is this? Looks like there is some template provider made by hashicorp that doesn’t work on the darwin laptops. OK, no problem I thought, there will be a version along soon enough… only come to find out that this project is archived on GitHub. Eek!
Eventually, after a lot of fruitless googling, I came across a comment on a now closed issue on GitHub with a workaround. For the benefit of the comment ever disappearing for whatever reason, here are the steps:
- Clone the repo: https://github.com/hashicorp/terraform-provider-template
- Build from source (eg. go build).
- Move the resulting binary to the global terraform plugins path: mv ~/.terraform.d/plugins/registry.terraform.io/hashicorp/template/2.2.0/darwin_arm64/terraform-provider-template_v2.2.0_x5
- Give it exec permissions (eg. chmod +x ).
- Then just do terraform init back in your repo.
But because I am installing terraform using homebrew I needed to create the folder
~/.terraform.d/plugins/registry.terraform.io/hashicorp/template/2.2.0/darwin_arm64/terraform-provider-template_v2.2.0_x5 first before I could move the binary. Having done all that I’m pleased to say it works!