You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is how tfenv solves this issue. It detects the architecture and checks if the version has the arm binary with hard coded versions, if no arm binary, then it downloads x86. This all works without having to override the env var.
# Set fallback arch
ASDF_HASHICORP_OVERWRITE_ARCH_FALLBACK=amd64
# This will install amd64 since arm64 is unavailable# https://releases.hashicorp.com/terraform/1.0.1/
asdf install terraform 1.0.1
# This will install since arm64 is available# https://releases.hashicorp.com/terraform/1.0.2/
asdf install terraform 1.0.2
Currently, I'm using this which doesn't do a retry but has a hard coded string for the last_version_before_arm which is 1.0.1 for terraform.
#!/usr/bin/env shasdftf() {
current_version_to_install="$*"# https://releases.hashicorp.com/terraform/1.0.1/# https://releases.hashicorp.com/terraform/1.0.2/
last_version_before_arm="1.0.1"# sort algorithm puts the earliest version first# ref: https://stackoverflow.com/a/25731924
get_earliest_version=$(printf '%s\n%s'"$last_version_before_arm""$current_version_to_install"| sort -t '.' -k 1,1 -k 2,2 -k 3,3 -k 4,4 -g | head -1)# if the version is the same, that means it's below 1.0.1if [ "$get_earliest_version"="$current_version_to_install" ];then
arch="amd64"else
arch=$(uname -m)fi
ASDF_HASHICORP_OVERWRITE_ARCH_TERRAFORM="$arch" asdf install terraform "$current_version_to_install"
}
$ asdftf 1.0.1
Downloading terraform version 1.0.1 from https://releases.hashicorp.com/terraform/1.0.1/terraform_1.0.1_darwin_amd64.zip
$ asdftf 1.0.2
Downloading terraform version 1.0.2 from https://releases.hashicorp.com/terraform/1.0.2/terraform_1.0.2_darwin_arm64.zip
The text was updated successfully, but these errors were encountered:
This is how tfenv solves this issue. It detects the architecture and checks if the version has the arm binary with hard coded versions, if no arm binary, then it downloads x86. This all works without having to override the env var.
https://github.com/tfutils/tfenv/blob/c05c364a0565b0bee63d97b763def4521d620884/libexec/tfenv-install#L85-L105
It would be nice to have a fallback set
On
arm64
Currently, I'm using this which doesn't do a retry but has a hard coded string for the
last_version_before_arm
which is1.0.1
for terraform.The text was updated successfully, but these errors were encountered: