以下の内容はhttps://timtoronto634.hatenablog.com/entry/2025/05/11/094804より取得しました。


Ubuntu への tfenv/terraform installation の備忘録

久しぶりに使うマシン (Ubuntu) の terraform が古かったので、入れ直すことにした。

既に install されている terraform の unisntall

おそらく apt-get だろうが、 どうやって install したか覚えていないので探ってみる。

$ which terraform
/usr/bin/terraform
$ dpkg -l | grep terraform
ii  terraform                                     1.11.4-1                                               amd64        Terraform enables you to safely and predictably create, change, and improve infrastructure. It is a tool that codifies APIs into declarative configuration files that can be shared amongst team members, treated as code, edited, reviewed, and versioned.

出力が出たので、 apt で入れたことが分かる。

$ sudo apt remove terraform

tfenv の install

依存関係の解決が発生すると面倒なので、package manger を使うより、 git から manual install するのが良いのではないかと思っている。

github.com

$ git clone --depth=1 https://github.com/tfutils/tfenv.git ~/.tfenv
$ echo $SHELL
/bin/bash
$ echo 'export PATH="$HOME/.tfenv/bin:$PATH"' >> ~/.bash_profile

terraform の install

$ tfenv install latest
Installing Terraform v1.11.4
Downloading release tarball from https://releases.hashicorp.com/terraform/1.11.4/terraform_1.11.4_linux_amd64.zip
################################################################################################################################################################################################## 100.0%
Downloading SHA hash file from https://releases.hashicorp.com/terraform/1.11.4/terraform_1.11.4_SHA256SUMS
Not instructed to use Local PGP (/home/uchida/.tfenv/use-{gpgv,gnupg}) & No keybase install found, skipping OpenPGP signature verification
Archive:  /tmp/tfenv_download.52tYPC/terraform_1.11.4_linux_amd64.zip
  inflating: /home/a2/.tfenv/versions/1.11.4/LICENSE.txt  
  inflating: /home/a2/.tfenv/versions/1.11.4/terraform  
Installation of terraform v1.11.4 successful. To make this your default version, run 'tfenv use 1.11.4'

asdf ? tenv ?

asdf は使っていましたが、shell の治安が悪くなったり、コマンドを忘れたりで意外と管理が楽にならなかったため、やめようとしています。

tfenv は新規開発が止まっており、古いという話があるようです。

新しいTerraformのバージョンマネージャー tenv を試してみた | DevelopersIO

後継として規模感もあるのが tenv OpenTofu にも焦点を当てているため、Terraform のみを使いたい場合は機能過多に感じる可能性あり

GitHub - tofuutils/tenv: OpenTofu / Terraform / Terragrunt and Atmos version manager

tfswitch というツールもある模様。 一応コードは公開されているが、利用者がすくないのは不安も残る

GitHub - warrensbox/terraform-switcher: A command line tool to switch between different versions of terraform (install with homebrew and more)

terraform 以外もまとめて管理するツールとして、 aqua というツールも出てきた。

そもそも

元々 1.11.4 が入っていたので、 install し直す必要はなかったというオチ




以上の内容はhttps://timtoronto634.hatenablog.com/entry/2025/05/11/094804より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14