WSL の Ubuntu で Terraform を使う

Windows 10 の WSL 上の Ubuntu から Terraform を使えるようにしたくなったので、インストールしてみました。


Terraform のインストール

WSL 上の Ubuntu で以下のような感じでコマンドを実行します。

$ sudo apt-get update 
$ sudo apt-get upgrade 
$ sudo apt-get install unzip
$ wget
$ unzip
$ sudo mv terraform /usr/local/bin
$ rm


$ terrafrom -v
Terraform v0.12.24


$ terraform init
Initializing modules...
- wordpress-us-vm in instance

Initializing the backend...

Initializing provider plugins...
- Checking for available provider plugins...
- Downloading plugin for provider "google" (hashicorp/google) 3.17.0...

The following providers do not have any version constraints in configuration,
so the latest version was installed.

To prevent automatic upgrades to new major versions that may contain breaking
changes, it is recommended to add version = "..." constraints to the
corresponding provider blocks in configuration, with the constraint strings
suggested below.

* version = "~> 3.17"

Terraform has been successfully initialized!

You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.

If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.