Use m1-terraform-provider-helper to compile Terraform providers for Mac M1

Corrado Ignoti
2 min readJan 30, 2023
Photo by Mikita Yo on Unsplash

I won’t repeat it again, Apple darwin_arm64 architecture is a disruptive event: choosing these new chips has its own pros and cons.

While using my new Macbook pro with the M1 chip, I often encounter issues in some of my old projects when working with Terraform. Either some terraform providers have not been ported to the new darwin_arm64 platform or the versions of the providers I used in thoose projects are freezed to an old version (for some compatibility reasons). In both cases, there is no pre-compiled binary for darwin_arm64, and you I have to compile it by myself. This is not a big problem the source code is freely available and thay can be easily compiled even if we had to wait for Go 1.16 to be released to make it possible.

To be short: there are 2 main problems when you use Terraform on a Silicon:

  • The general availability of darwin_arm64 Terraform providers: there are often cases where the maintainers did not release a darwin_arm64 version (only the 28% of the provieders supports the Apple Silicon platform, see here for details).
  • In many projects, a specific provider version is freezed and upgrading is not an option (due to breaking changes in the new version that make impossible to upgrade without compromise the entire project)

In both cases, it is necessary to compile the provider by yourself for Apple Silicon. You can do it following the instructions in the README.md file and activating it by hand or… you can use this CLI tool: https://github.com/kreuzwerker/m1-terraform-provider-helper

It has commands to activate or deactivate the usage of locally compiled providers in Terraform projects and it provides an easy way to install (and compile) a specific provider version.

How to Use

You can install the tool via brew:

brew install kreuzwerker/taps/m1-terraform-provider-helper

Let’s say you want to install the provider “fantastic_provider” in version 1.0.0 because you are using it in a project and there isn’t a pre-build binary for Mac M1:

First you have to activate the helper:

me@myhost$ m1-terraform-provider-helper activate

Then you have to install and compile the provider whit this command:

m1-terraform-provider-helper install provider/fantastic_provider -v 1.0.0

--

--

Corrado Ignoti

Mobile enthusiastic with open source always in mind. Guitar player and music lover. With the head in the "cloud". Scout for the rest. He/him