Terraform Installation (on Windows)

Edward Viaene
A free video tutorial from Edward Viaene
DevOps, Cloud, Big Data Specialist
4.3 instructor rating • 12 courses • 167,048 students

Learn more from the full course

Learn DevOps: Infrastructure Automation With Terraform

Learn how to automate your infrastructure with terraform. Covers Terraform with AWS, Packer, Docker, ECS, EKS, Jenkins

08:01:55 of on-demand video • Updated June 2020

  • Understand, use and apply terraform
  • Know when to use different features
  • Use terraform with AWS
  • Use terraform with Packer to create custom images
  • Be able to apply DevOps techniques using terraform
English Instructor: In this demo, I will show you how to install Terraform on Windows and I will also show you how to create SSH keys using PuTTYGen, because at some point you will need to create SSH keys. If you are not on Windows, you can skip this lecture or in the next demo I also show you how to boot a Linux VM on Windows, which can also make it easier to have all the tools available within a VM. So, let's get started. I have a Windows machine here and I just went to terraform.io where I can then download the latest release, 0.11.7 at the moment, so I am on Windows 64 bit. And then once downloaded, it comes in a zip file. So we can just right click it and Extract All and I will actually extract it in the Terraform directory, C:\terraform. Extract. So, now I have C:\terraform with the Terraform executable. I can now open CMD or PowerShell, depending on what version of Windows you are on, and then you can start using Terraform. If you want to have a Terraform executable available everywhere, then you just want to type terraform and then you want it to have it available everywhere, then you need to set it in the path, because otherwise Windows will not find it. To set it in the path, you can just open a browser, a file browser, and then you will have your PC, in this case it's called My PC. You can go to Properties. You can go to advanced system settings, and there you can configure environment variables. Here, one of the environment variables is the path. And the path you can edit and you can add C:\terraform to the path. You want to save this, and then we might have to close this so that the path gets reloaded. PowerShell, terraform, and now we can actually execute Terraform in any directory that you want. So, if you type terraform --version, it should work. So I am now running on version 0.11.7, so that's it for a Terraform installation. Later in the course, you will have to create SSH keys and while it's very easy on Linux and Mac to do so, because you can use the command ssh-keygen, which is not always available on Windows. If you are running Windows 10, then you should be able to install an open SSH packet somewhere, but it's not always available, so I'll show you something that always works whatever Windows version you are on. So, if I go to Google and I type putty, I'll be able to download PuTTY, which is an SSH client. 64 bit version, and I also want PuTTYgen, which is a RSA and DSA key generation utility. So we'll also download this one. PuTTY, I need to install. You can just follow the installation and then PuTTY will allow me to SSH to my servers (mumbles). So I have PuTTY, so this you can use to SSH on port 22. Whenever I type SSH on the course, you can use PuTTY instead, but to use SSH certificates, you can create those with PuTTYgen, and actually I downloaded PuTTYgen, but if you downloaded the installer, it also might have installed PuTTYgen. So, we can run PuTTYgen, and you can do generate new key pair, and this will generate a new key pair for you. It can take some time, you can to move your mouse a bit so that it generates a random list, and then this is your key. So this is the public key that you can use, so we can see the public key. Oh, I saved it in also C:\terraform, for example, but you can save it wherever you want. This is mykey.pup. And then you can also export an SSH key. And this is mykey. So whenever in the course I'm talking about mykey and my SSH key, then we're talking about these. You can generate them yourself using this tool. You can also put a passphrase on it, that made them keyless but if you want you can also put a passphrase on it. To be able to use this key in PuTTY, you'll also need to save this key in a PuTTY format, so if you click Save Private Key, then you can also save it as a ppk file. So, mykey.ppk. And then if you want to connect to a host, you can enter the host name here, but you also need to go to connection, SSH, authentication, and then here you can browse, I can go to C:\terraform and you have here mykey, your PuTTY compatible key that you can use to then login to your host name. Now you can save your session here, like mysession. I can then click Save and every time you need to login, you can just load it, change the host name and it will use this key. So this is if you want to use SSH with PuTTY and then you also have an open SSH compatible key if you need to use it with Terraform later on. So, that's it for Windows. So, if you're running Windows then you should be all set now. In the next demo I will then show you how to run Vagrant with VirtualBox which you can skip if you don't want to run a VM on your Windows machine. It will just show you how to do everything in Linux on your Windows machine, but if you want you can also do everything in Windows, because I just showed you how to install Terraform and PuTTY.