tfswitchをlinuxにインストールする
この記事のmac版。
tfswitchとは?
公式:https://warrensbox.github.io/terraform-switcher/
日本語資料が少ないようなので、改めて使い勝手を記載しようと思います。
使いたいバージョンを選ぶだけ!!
$ tfswitch
Use the arrow keys to navigate: ↓ ↑ → ←
? Select Terraform version:
▸ 0.14.4 *recent
0.14.3
0.14.2
0.14.1
↓ 0.14.0
インストール済みのバージョンは *recent
って記載されます。
インストールされてないバージョンも選択するだけで、自動でインストールされて使えるようになります。
新しいバージョンもリリースされると勝手に選択肢に追加されてます。
以上!簡単!
その他の使い方はした事ありませんが、公式サイトに載ってました。
https://tfswitch.warrensbox.com/Quick-Start/
インストール
公式:https://tfswitch.warrensbox.com/Install/#homebrew
macOS Mojaveで試しました。
$ brew install warrensbox/tap/tfswitch
(省略)
$ terraform --version
bash: /usr/local/bin/terraform: No such file or directory
(初回、なにもバージョン指定していない状態だとエラーになる)
$ tfswitch
✔ 0.14.0
Downloading https://releases.hashicorp.com/terraform/0.14.0/terraform_0.14.0_darwin_amd64.zip to terraform_0.14.0_darwin_amd64.zip
Downloading ...
34386076 bytes downloaded.
Switched terraform to version "0.14.0"
$ terraform --version
Terraform v0.14.0
Your version of Terraform is out of date! The latest version
is 0.14.4. You can update by downloading from https://www.terraform.io/downloads.html
$ tfswitch
✔ 0.14.4
Downloading https://releases.hashicorp.com/terraform/0.14.4/terraform_0.14.4_darwin_amd64.zip to terraform_0.14.4_darwin_amd64.zip
Downloading ...
34312707 bytes downloaded.
Switched terraform to version "0.14.4"
$ terraform --version
Terraform v0.14.4
トラブルシューティング
tfswitchのインストール前にterraformをインストールしちゃってると、brew unlink
を促されました。
アンインストールしちゃってもいいと思います。
公式のトラブルシューティングはこちら:https://tfswitch.warrensbox.com/Troubleshoot/