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?

DockerではじめるTerraform【インストール編】

Last updated at Posted at 2025-12-10

はじめに

Terraformのインストール方法としては、以下の2種類があります。

  • パッケージ管理ツールを使用した自動インストール

  • 手動でバイナリ版のコマンドをダウンロードしてPATHが通る場所に設置する

本記事では今後のコマンドのアップデート等を考慮して、Windowsに標準搭載されている
パッケージ管理ツールの「winget」を使用したインストール方法まとめました。

事前準備(想定環境)💻

  • Windows11 環境 (シェル:PowerShell)

コマンドインストール手順

✅ターミナルを開きます

スタートボタンを右クリックして、「ターミナル (管理者)」を選択します。

✅Terraformを検索します

以下のコマンドを実行し、パッケージが存在することを確認します。

PS C:\Users\User001\> winget search terraform
Name                         Id                           Version              Match              Source
--------------------------------------------------------------------------------------------------------
HashiCorp Terraform          Hashicorp.Terraform          1.14.0               Moniker: terraform winget
Hashicorp Terraform Alpha    Hashicorp.Terraform.Alpha    1.10.0-alpha20240828 Moniker: terraform winget
Hashicorp Terraform Beta     Hashicorp.Terraform.Beta     1.7.0-beta2          Moniker: terraform winget
Hashicorp Terraform RC       Hashicorp.Terraform.RC       1.8.0-rc1            Moniker: terraform winget
【以下省略】

✅Terraformをインストールします

以下のコマンドを実行します。

PS C:\Users\User001\> winget install HashiCorp.Terraform

インストールが正常に完了すると以下のメッセージが表示されます。

Successfully installed

✅Terraformコマンドの確認

インストールに成功した場合、下記のTerraformコマンドを実行すると
バージョン情報が表示されます。

PS C:\Users\User001\> terraform version
Terraform v1.14.0
on windows_amd64

Terraformコマンドのインストール先は以下になります。

PS C:\Users\User001\> where.exe terraform
C:\Users\User001\AppData\Local\Microsoft\WinGet\Links\terraform.exe

パッケージ管理ツールを使用したインストールのため、PATHも自動で追加されます。

PS C:\Users\User001> $env:PATH
【中略】
C:\Users\User001\AppData\Local\Microsoft\WinGet\Links;

📝HashiCorp公式サイトのインストール動画では、パッケージ管理ツールの
chocolatey」を使用したインストール方法が紹介されておりますが、
choco」コマンドのインストール先は以下になります。

PS C:\Users\User001\> where.exe choco
C:\ProgramData\chocolatey\bin\choco.exe

おわりに

ここまで読んでいただいた皆様、
誠にありがとうございました。😎

本記事はWindowsのローカル環境に初めてTerraformを
インストールした時に、「chocolatey:chocolate_bar:」と「winget」
どちらのパッケージ管理ツールを使用するべきか
少し迷った経験から、結局どちらでも良かった
備忘録を兼ねてインストール手順を共有することを考えました。

本記事の内容が、何かしらのお役に立てれば幸いです。:bow_tone1:

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?