0
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 1 year has passed since last update.

Terraformインストールとtfenvでバージョン管理

Last updated at Posted at 2022-10-14

1.tfenvのインストール

githubからcloneしてくる。

git clone https://github.com/tfutils/tfenv.git ~/.tfenv

.bash_profileにPATHを追加し反映する。

echo 'export PATH="$HOME/.tfenv/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile

2.terraformのインストール

2通りの方法を記載します。

 1.HashicorpからZIPをダウンロードする方法

  hashicorpからzipをダウンロードし解凍後、/usr/local/bin/に移す。

sudo curl https://releases.hashicorp.com/terraform/1.2.0/terraform_1.2.0_linux_amd64.zip -o terra.zip
unzip terra.zip -d /usr/local/bin/

  terraformコマンドが機能するのを確認する。

terraform --version
Terraform v1.2.0
on linux_amd64

 2.yumレポジトリにhashicorp.repoを追加しyumでインストール方法

  yumのレポジトリ管理にはyum-config-managerコマンドを使うと便利です。

  それにはyum-utilsがインストールされている事が前提です。

sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo
sudo yum -y install terraform

3.Terraformのバージョン指定

インストール可能なバージョン確認

tfenv list-remote

バージョンを指定してインストール

tfenv install 1.3.2

インストール済みのバージョン確認

tfenv list
* 1.3.2 (set by /home/ec2-user/.tfenv/version)

バージョンの切り替え

tfenv use 1.3.2
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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?