gokigenmaruのブログ

40から始めるクラウドエンジニア

Windows11のWSL(Ubuntu20.04)にterraformをインストールする

仕事用のPCをWindows11にしました!
ちょっとMacっぽい気がする…気がするだけです。

ということで、いろいろと入れ直しになったついでにブログ書いてみます。

やったことはWSLにterraformをインストールしただけです。
WSLはUbuntu20.04
特に何も問題なくインストール出来ました。

インストール方法はHashiCorpのサイトに記載があります。
terraform.io

このサイトに沿って実施。問題なく完了。

MyPC:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.3 LTS
Release:        20.04
Codename:       focal
MyPC:~$ which terraform
MyPC:~$ curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -
[sudo] password for nagahashi:
OK
MyPC:~$ sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
Get:1 https://apt.releases.hashicorp.com focal InRelease [15.4 kB]
Get:2 https://apt.releases.hashicorp.com focal/main amd64 Packages [50.7 kB]
Get:3 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Hit:4 http://archive.ubuntu.com/ubuntu focal InRelease
Get:5 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Get:6 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages [1347 kB]
Get:7 http://archive.ubuntu.com/ubuntu focal-backports InRelease [108 kB]
Get:8 http://security.ubuntu.com/ubuntu focal-security/main Translation-en [234 kB]
Get:9 http://security.ubuntu.com/ubuntu focal-security/main amd64 c-n-f Metadata [9800 B]
Get:10 http://security.ubuntu.com/ubuntu focal-security/restricted amd64 Packages [831 kB]
Get:11 http://security.ubuntu.com/ubuntu focal-security/restricted Translation-en [118 kB]
Get:12 http://security.ubuntu.com/ubuntu focal-security/restricted amd64 c-n-f Metadata [532 B]
Get:13 http://security.ubuntu.com/ubuntu focal-security/universe amd64 Packages [695 kB]
Get:14 http://security.ubuntu.com/ubuntu focal-security/universe Translation-en [122 kB]
Get:15 http://security.ubuntu.com/ubuntu focal-security/universe amd64 c-n-f Metadata [14.1 kB]
Get:16 http://security.ubuntu.com/ubuntu focal-security/multiverse amd64 Packages [20.7 kB]
Get:17 http://security.ubuntu.com/ubuntu focal-security/multiverse Translation-en [5196 B]
Get:18 http://security.ubuntu.com/ubuntu focal-security/multiverse amd64 c-n-f Metadata [500 B]
Get:19 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [1674 kB]
Get:20 http://archive.ubuntu.com/ubuntu focal-updates/main Translation-en [316 kB]
Get:21 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 c-n-f Metadata [14.9 kB]
Get:22 http://archive.ubuntu.com/ubuntu focal-updates/restricted amd64 Packages [887 kB]
Get:23 http://archive.ubuntu.com/ubuntu focal-updates/restricted Translation-en [127 kB]
Get:24 http://archive.ubuntu.com/ubuntu focal-updates/restricted amd64 c-n-f Metadata [528 B]
Get:25 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [913 kB]
Get:26 http://archive.ubuntu.com/ubuntu focal-updates/universe Translation-en [203 kB]
Get:27 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 c-n-f Metadata [20.3 kB]
Get:28 http://archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 Packages [24.4 kB]
Get:29 http://archive.ubuntu.com/ubuntu focal-updates/multiverse Translation-en [7336 B]
Get:30 http://archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 c-n-f Metadata [592 B]
Get:31 http://archive.ubuntu.com/ubuntu focal-backports/main amd64 Packages [42.2 kB]
Get:32 http://archive.ubuntu.com/ubuntu focal-backports/main Translation-en [10.1 kB]
Get:33 http://archive.ubuntu.com/ubuntu focal-backports/universe amd64 Packages [22.7 kB]
Get:34 http://archive.ubuntu.com/ubuntu focal-backports/universe Translation-en [15.4 kB]
Get:35 http://archive.ubuntu.com/ubuntu focal-backports/universe amd64 c-n-f Metadata [804 B]
Fetched 8078 kB in 4s (2054 kB/s)
Reading package lists... Done
MyPC:~$ sudo apt-get update && sudo apt-get install terraform
Hit:1 https://apt.releases.hashicorp.com focal InRelease
Hit:2 http://security.ubuntu.com/ubuntu focal-security InRelease
Hit:3 http://archive.ubuntu.com/ubuntu focal InRelease
Hit:4 http://archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:5 http://archive.ubuntu.com/ubuntu focal-backports InRelease
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  terraform
0 upgraded, 1 newly installed, 0 to remove and 93 not upgraded.
Need to get 18.8 MB of archives.
After this operation, 63.3 MB of additional disk space will be used.
Get:1 https://apt.releases.hashicorp.com focal/main amd64 terraform amd64 1.1.7 [18.8 MB]
Fetched 18.8 MB in 1s (26.8 MB/s)
Selecting previously unselected package terraform.
(Reading database ... 42170 files and directories currently installed.)
Preparing to unpack .../terraform_1.1.7_amd64.deb ...
Unpacking terraform (1.1.7) ...
Setting up terraform (1.1.7) ...
MyPC:~$ which terraform
/usr/bin/terraform