1 00:00:07,010 --> 00:00:08,330 - Okay, so in this section, 2 00:00:08,330 --> 00:00:13,330 we're gonna download and install the Terraform CLI. 3 00:00:13,470 --> 00:00:15,980 This is one of the easiest software packages 4 00:00:15,980 --> 00:00:17,070 that you'll ever have to install. 5 00:00:17,070 --> 00:00:19,390 There's two main ways to do this. 6 00:00:19,390 --> 00:00:21,150 The first way is to install the CLI 7 00:00:22,960 --> 00:00:24,820 on your laptop or your work station 8 00:00:24,820 --> 00:00:26,370 or whatever you're using. 9 00:00:26,370 --> 00:00:28,320 And then the other way is to do it through docker. 10 00:00:28,320 --> 00:00:30,150 They're both very, very simple. 11 00:00:30,150 --> 00:00:32,080 So let's just go ahead and get started. 12 00:00:32,080 --> 00:00:35,810 So, first we just browse to terraform.io. 13 00:00:35,810 --> 00:00:38,750 This is just the homepage with HashiCorp's website 14 00:00:38,750 --> 00:00:39,600 for Terraform. 15 00:00:39,600 --> 00:00:43,050 And then we simply select download CLI, 16 00:00:43,050 --> 00:00:44,690 and then you'll find your version in here. 17 00:00:44,690 --> 00:00:47,130 I'm running MacOS, so I'm gonna select that. 18 00:00:47,130 --> 00:00:50,630 But you can see that it's supported on FreeBSD, Linux, 19 00:00:50,630 --> 00:00:52,670 OpenBSD, Solaris and Windows. 20 00:00:52,670 --> 00:00:55,270 So we're gonna select MacOS, 21 00:00:55,270 --> 00:00:58,400 and this is gonna download a zip file. 22 00:00:58,400 --> 00:01:01,100 So we'll just tell it to open, go ahead and open that. 23 00:01:01,970 --> 00:01:03,620 Okay, so 24 00:01:03,620 --> 00:01:07,200 this has unzipped the file, and it contains 25 00:01:07,200 --> 00:01:09,550 simply one file called Terraform. 26 00:01:09,550 --> 00:01:11,053 It's a binary executable. 27 00:01:13,970 --> 00:01:15,550 And then we simply have to move this 28 00:01:15,550 --> 00:01:16,893 to someplace in the path. 29 00:01:18,138 --> 00:01:20,210 And you can put this anywhere you like on your file system. 30 00:01:20,210 --> 00:01:24,230 I usually use user local bin, 'cause I'm on a Mac, 31 00:01:24,230 --> 00:01:27,180 and that's a convenient location that's already in my path. 32 00:01:28,420 --> 00:01:30,010 So 33 00:01:30,010 --> 00:01:33,610 we're just going to go to a command line, 34 00:01:33,610 --> 00:01:35,160 and we're gonna move that file. 35 00:01:41,200 --> 00:01:42,920 And it downloaded as Terraform 2 36 00:01:42,920 --> 00:01:45,230 because I already had another copy of Terraform, 37 00:01:45,230 --> 00:01:48,757 but you will probably just see the filename Terraform. 38 00:01:56,565 --> 00:01:57,398 Okay. 39 00:01:57,398 --> 00:01:58,853 So now, Terraform is installed. 40 00:02:04,750 --> 00:02:08,850 Okay, so 12.13, that was the version that we were expecting. 41 00:02:08,850 --> 00:02:11,040 So that's it for installing Terraform. 42 00:02:11,040 --> 00:02:13,210 It's one of the simplest things, it's a single binary. 43 00:02:13,210 --> 00:02:14,580 Very, very simple. 44 00:02:14,580 --> 00:02:17,270 There is another way, though, which is to use docker. 45 00:02:17,270 --> 00:02:19,163 So this is also very common. 46 00:02:20,990 --> 00:02:24,810 Docker is a great way to use Terraform 47 00:02:24,810 --> 00:02:29,360 because it's always going to run in a Linux environment, 48 00:02:29,360 --> 00:02:31,800 and so that's a good way to ensure that 49 00:02:31,800 --> 00:02:35,370 all pathing and everything is consistent. 50 00:02:35,370 --> 00:02:38,730 So if you're on Windows or on Mac, 51 00:02:38,730 --> 00:02:43,300 I think it's a good idea to run Terraform inside a docker. 52 00:02:43,300 --> 00:02:44,660 And so the way to do that 53 00:02:45,560 --> 00:02:47,260 is that you can simply docker pull 54 00:02:51,560 --> 00:02:52,473 HashiCorp. 55 00:02:55,570 --> 00:02:56,993 And you can use latest. 56 00:03:00,290 --> 00:03:02,610 And then once you're a little bit further 57 00:03:02,610 --> 00:03:04,490 into developing your Terraform, you probably 58 00:03:04,490 --> 00:03:05,803 don't wanna use latest. 59 00:03:06,830 --> 00:03:08,313 And so you can specify. 60 00:03:10,760 --> 00:03:13,063 You can see this is the same version, 0.12.13, 61 00:03:13,063 --> 00:03:15,593 this is the same version from the example above. 62 00:03:18,222 --> 00:03:19,173 And we can run it. 63 00:03:27,870 --> 00:03:29,043 Same way we did before. 64 00:03:38,974 --> 00:03:40,493 Okay, and that needs to be qualified. 65 00:03:41,970 --> 00:03:45,200 Okay, so that one worked, that one ran inside a docker. 66 00:03:45,200 --> 00:03:46,140 If we just run 67 00:03:47,260 --> 00:03:49,900 Terraform that's running from the Mac, 68 00:03:49,900 --> 00:03:50,860 and if we run 69 00:03:52,010 --> 00:03:54,360 docker run, then it runs in a docker container. 70 00:03:54,360 --> 00:03:56,550 You can see there's a tiny bit of delay 71 00:03:56,550 --> 00:03:59,250 when we run it in docker, because it has to start a VM 72 00:04:00,980 --> 00:04:02,380 and run it that way. 73 00:04:02,380 --> 00:04:03,960 But I encourage you to run it in docker. 74 00:04:03,960 --> 00:04:06,310 Most of the time, if you're gonna be running this 75 00:04:06,310 --> 00:04:08,450 in a continuous delivery system, 76 00:04:08,450 --> 00:04:10,960 that that's gonna be running inside a docker. 77 00:04:10,960 --> 00:04:13,379 And we will be talking about continuous delivery 78 00:04:13,379 --> 00:04:15,723 in one of the later lessons.