1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

tfenv操作まとめ

Posted at

tfenvとは?

terrafromのバージョン管理をしてくれる。
https://github.com/tfutils/tfenv

インストール

$ brew install tfenv

ちなみに既にterraformを落としている状態だと下記のようなエラーが発生した。

Error: Cannot install tfenv because conflicting formulae are installed.
  terraform: because tfenv symlinks terraform binaries

Please `brew unlink terraform` before continuing.

指示通りunlinkを実行すると解消される。

$ brew unlink terraform
$ brew install tfenv
$ tfenv -v
# tfenv 2.2.2

色々なコマンド

list-remote

現在インストール可能なterraformのバージョンリストが確認できる。

$tfenv list-remote
0.15.4
0.15.3
0.15.2
0.15.1

install

指定バージョンのterrafromインストール。

$tfenv install 0.15.4

list

インストール済みのバージョンを列挙する。

$ tfenv list
0.15.4

use

デフォルトバージョンの切り替え。

$ tfenv use 0.15.4
Switching default version to v0.15.4
Switching completed

リポジトリ内のバージョンの固定

.terraform-versionファイルをリポジトリに含めて、 tfenv installすると、
チームメンバーも指定のバージョンで統一することができる。

$ echo 0.15.4 > .terraform-version
$ tfenv install

参考

1
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?