terraform-switcher icon indicating copy to clipboard operation
terraform-switcher copied to clipboard

Ability to specify the terraform architecture to install on darwin platform

Open edmondsiu0 opened this issue 1 year ago • 12 comments

Is your feature request related to a problem? Please describe. The terraform configuration used by my organisation relies on a deprecated provider that only provides binary in darwin_amd64 architecture.
During the upgrade process to make our code ARM compatible, I was testing the code on my local machine to ensure the existing code is known-good.
To do that I fetched the code, used tfswitch to switch to the intended version and ran Terraform init.

I then discovered while tfswitch is capable of identifying the platform that I'm on (darwin_arm64) and fetches the corresponding binary, I was not able to override this behaviour to force it to fetch darwin_amd64.

Being unable to fetch darwin_amd64 means I have to manually download the binary and move it into place before I can resume testing.

Describe the solution you'd like tfswitch should accept an additional optional argument along with version, when supplied tfswitch should override the default architecture decision and install the specified architecture instead.

For example:

tfswitch 1.5.6 darwin_amd64

Describe alternatives you've considered I have manually downloaded and linked the binary on my local machine.
This is the method I'd use without this feature in place, and there is no alternatives right now.

Additional context Mac OS on ARM is capable of running darwin_amd64 binaries (with Rosetta 2 translation).
Terraform fetches provider based on it's own architecture, which means Terraform code that uses providers with only darwin_amd64 binary can still be executed on Mac, as long as Terraform binary is also running on darwin_amd64 architecture.

edmondsiu0 avatar Oct 13 '23 08:10 edmondsiu0