tfutils / tfenv

Terraform version manager
MIT License
4.43k stars 450 forks source link

`arm64` availability is different across Linux and Mac #350

Closed denizgenc closed 1 year ago

denizgenc commented 2 years ago

The intent of #287 was to allow users on arm64 architectures to download amd64 binaries if there was no arm64 binary available. However, it was mostly tested against Linux, which had arm64 support implemented earlier than Macs. As such, I get the following issues when I try to download older Terraform versions on my M1 Mac:

$ tfenv install 0.12.30
Installing Terraform v0.12.30
Downloading release tarball from https://releases.hashicorp.com/terraform/0.12.30/terraform_0.12.30_darwin_arm64.zip
curl: (22) The requested URL returned error: 404                                                   

Tarball download failed

There is a terraform_0.12.30_linux_arm64.zip but no terraform_0.12.30_darwin_arm64.zip. If I try installing 0.12.29, which doesn't have arm64 support at all, I get the amd64 binary as expected:

$ tfenv install 0.12.29
Installing Terraform v0.12.29
Downloading release tarball from https://releases.hashicorp.com/terraform/0.12.29/terraform_0.12.29_darwin_amd64.zip
...

This should be fixed by separating the TFENV_ARCH logic for Linux and MacOS. The MacOS regex should be much simpler, since M1 builds started from version 1.0.2.