Skip to content

Commit 7fa53e1

Browse files
committed
fix terraform for apple silicon
1 parent 688e43a commit 7fa53e1

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

artifacts/install.sh

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,18 @@ main() {
3535
fi
3636
if ! check_cmd terraform; then
3737
terraform_url="https://releases.hashicorp.com/terraform/${cur_terraform_ver}/terraform_${cur_terraform_ver}_${ostype}_${cputype}.zip"
38-
ensure downloader "$terraform_url" "$HOME/.darknode/bin/terraform.zip"
39-
ensure unzip -qq "$HOME/.darknode/bin/terraform.zip" -d "$HOME/.darknode/bin"
40-
ensure chmod +x "$HOME/.darknode/bin/terraform"
41-
rm "$HOME/.darknode/bin/terraform.zip"
38+
39+
# The official terraform download page doesn't have bins for apple silicon before v1.0.0
40+
# so we have to build ourselves and upload to the cli release
41+
if [ "$ostype" = 'darwin' -a "$cputype" = 'arm64' ];then
42+
terraform_url="https://www.github.com/renproject/darknode-cli/releases/download/3.1.0/terraform_darwin_arm64"
43+
ensure downloader "$terraform_url" "$HOME/.darknode/bin/terraform"
44+
else
45+
ensure downloader "$terraform_url" "$HOME/.darknode/bin/terraform.zip"
46+
ensure unzip -qq "$HOME/.darknode/bin/terraform.zip" -d "$HOME/.darknode/bin"
47+
ensure chmod +x "$HOME/.darknode/bin/terraform"
48+
rm "$HOME/.darknode/bin/terraform.zip"
49+
fi
4250
fi
4351
progressBar 50 100
4452

@@ -118,7 +126,7 @@ check_architecture() {
118126
:
119127
elif [ "$ostype" = 'linux' -a "$cputype" = 'aarch64' ]; then
120128
:
121-
elif [ "$ostype" = 'darwin' -a "$cputype" = 'x86_64' ]; then
129+
elif [ "$ostype" = 'darwin' ]; then
122130
if [ "$cputype" = 'x86_64' ]; then
123131
:
124132
elif [ "$cputype" = 'arm64' ]; then

0 commit comments

Comments
 (0)