TFSwitch 使いましょう
terraform のバージョン管理ツール
環境
OS環境:macOS Big Sur ver11.1
インストール
brewコマンドにて、インストール
$ brew update
$ brew install warrensbox/tap/tfswitch
Error
エラーが発生しました。お使いのCLTはmacOS 11をサポートしていません。
それは古いか、変更されています。
CLTをアップデートするか、アップデートがない場合は削除してください。
システム環境設定のソフトウェアアップデートからアップデートするか、実行してください。
$ softwareupdate --all --install --force
アップデートは表示されなかったので
それでもアップデートが表示されない場合は、以下のようにしてください。
$ sudo rm -rf /Library/Developer/CommandLineTools
$ sudo xcode-select --install
Error
もともとterraformwpインストールしてしまっているとシンボリックリンクが貼られていてダメみたいですね。
$ brew unlink terraform
バージョン確認
$ tfswitch -v
terraform インストール
$ tfswitch
セレクトできるようになるので、インストールしたいバージョンの選択すると勝手にインストールされる。
今回は、v0.12
へのアップデートを確認したいので、v0.12
系をインストール
バージョン確認
$ terraform -version
Terraform v0.12.30
バージョンアップ対応
今回は、v0.11
👉 v0.12
へのアップデートを調査
$ terraform 0.12upgrade
This command will rewrite the configuration files in the given directory so
that they use the new syntax features from Terraform v0.12, and will identify
any constructs that may need to be adjusted for correct operation with
Terraform v0.12.
We recommend using this command in a clean version control work tree, so that
you can easily see the proposed changes as a diff against the latest commit.
If you have uncommited changes already present, we recommend aborting this
command and dealing with them before running this command again.
Would you like to upgrade the module in the current directory?
Only 'yes' will be accepted to confirm.
Enter a value:
何も出なければ、正常完了で、既存のコードが修正されます。
エラーが出たら、その修正を行い再度、実行します。
AWS EBSのgp3
を使用したいがために、v0.14
系まで上げるのしんどい。
とほほ。