LoginSignup
0
0

More than 1 year has passed since last update.

tfenv で M1 対応の terraform をインストールする

Posted at

動機

この issue のエラーを回避するために、 tfenv で Terraform が amd64 で入ってくるのを回避したかった。

以下のように、 tfenv install **** をすると amd64 が入ってきてしまう。

$ tfenv install 1.2.2  
Installing Terraform v1.2.2
Downloading release tarball from https://releases.hashicorp.com/terraform/1.2.2/terraform_1.2.2_darwin_amd64.zip
######################################################################################################################################################################################################################################################### 100.0%
Downloading SHA hash file from https://releases.hashicorp.com/terraform/1.2.2/terraform_1.2.2_SHA256SUMS
No keybase install found, skipping OpenPGP signature verification
Archive:  tfenv_download.WOq4o7/terraform_1.2.2_darwin_amd64.zip
  inflating: /opt/homebrew/Cellar/tfenv/2.2.2/versions/1.2.2/terraform  
Installation of terraform v1.2.2 successful. To make this your default version, run 'tfenv use 1.2.2'

環境

M1 Macbook Air

方法

README.md に書いてありました。 arm64 を渡してあげれば良さそう。

TFENV_ARCH=arm64
$ TFENV_ARCH=arm64 tfenv install 1.2.2
Installing Terraform v1.2.2
Downloading release tarball from https://releases.hashicorp.com/terraform/1.2.2/terraform_1.2.2_darwin_arm64.zip
######################################################################################################################################################################################################################################################### 100.0%
Downloading SHA hash file from https://releases.hashicorp.com/terraform/1.2.2/terraform_1.2.2_SHA256SUMS
No keybase install found, skipping OpenPGP signature verification
Archive:  tfenv_download.zmM3xS/terraform_1.2.2_darwin_arm64.zip
  inflating: /opt/homebrew/Cellar/tfenv/2.2.2/versions/1.2.2/terraform  
Installation of terraform v1.2.2 successful. To make this your default version, run 'tfenv use 1.2.2'

Terraform の公式のダウンロード URL を見に行くみたいで、 arm だけだとダメだった。

TFENV_ARCH=arm tfenv install 1.2.2
Installing Terraform v1.2.2
Downloading release tarball from https://releases.hashicorp.com/terraform/1.2.2/terraform_1.2.2_darwin_arm.zip
#=#=-  #       #
#=O#-     #        #
-#O=- #      #          #
curl: (22) The requested URL returned error: 404

Tarball download failed

.zshrc, .bashrc で常に環境変数がセットされるようにすると良さそう。
もし amd64 で terraform init していたら、 arm64 で入れ直した後にもう一度 terraform init をする。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0