terraform-switcher
terraform-switcher copied to clipboard
Handle multiple terraform architecture (arm64/amd64) for the same version
We use multiple version of terraform in arch amd64 and arm64.
With recent terraform stacks, no problem, we can run all terraform/provider as arm64 binaries, but for older stacks, that use unmaintained provider (available only as amd64), we need to run terraform as amd64 (via rosetta 2) ...
In this last case, tfswitch don't download terraform again because the version already exist in ~/.terraform.versions ... but with bad arch.
The proposed patch add the architecture to the terraform binary name to be able to have an arm64 and amd64 version of the same terraform version and let the user choose a specific architecture for terraform (with the new -a / --arch parameter).
Hi @alex-ikse, could you elaborate on the problem and scenarios where you need to override runtime.GOARCH
? Wouldn't you then need a machine running the given architecture to execute tfswitch? I don't think I'm following.
Might be good to file an associated issue as well.
tfenv handles with TFENV_ARCH=amd64
which downloads the amd64 version (instead of arm64 specified by runtime.GOARCH
). The amd64 version of Terraform is run via Rosetta for compatibility with providers that haven't been updated to arm64 yet.
I am looking for the options to switch between native darwin_arm64
and darwin_amd64
as well. I have a number of providers that don't have native darwin_arm64
support yet.
With recent terraform stacks, no problem, we can run all terraform/provider as arm64 binaries, but for older stacks, that use unmaintained provider (available only as amd64), we need to run terraform as amd64 (via rosetta 2) ...
Is this still a matter?
If it is, then a) what would be the version constraint for "older stacks" and b) should this be restricted to only specific OS family, arch, and TF versions? Especially given that this covers exactly specific OS family, arch and TF versions...
I don't see a use case for an arbitrary e.g. Linux of amd64
arch to get arm64
version of Terraform along with getting it linked as a default terraform
binary.
ps: overall the idea of using tfswitch
as "terraform getter" looks interesting... apart from auto-linking binary with incompatible ABI into a default location. Maybe it's worth of a complimentary cmdline option like --force-install
? 🤔
Closing as stale. Please update this thread if this is still a case and we'll look into it again. Thanks.