Installation And Setup Terraform On Windows

Installation of Terraform is very simple in Windows, you just need to download a binary file and use it. Terraform works on multiple platforms like Windows, Linux, macOS, etc. This article demonstrates terraform installation steps in windows.

Step 1 - Download Terraform from Google

Go to https://www.terraform.io/downloads.html, then click on Windows 64-bit option.

Installation And Setup Terraform On Windows

Once the archived has been downloaded, it has single binaries called terraform.exe.

Step 2 - Extract Terraform.exe from downloaded archived

Now we need to extract the zip file into the desktop. Once extraction has been completed, run command prompt, go to desktop, and run terraform command.

Installation And Setup Terraform On Windows

Now the problem here is that we placed terraform.exe file on the desktop and if we try terraform command in any other folder, it won’t work. Here I created terraform_lab folder on desktop and try to run terraform command from there. And we are getting as 'terraform' is not recognized as an internal or external command, operable program, or batch file.

Installation And Setup Terraform On Windows

To make it work, we need to follow subsequent steps to configure in an environment variable.

Step 3 - Configure Environment Variable Path for Terraform.exe

In C drive create a folder called TerraformBinaries and place exe file there.

Installation And Setup Terraform On Windows

Now right click on properties of PC, click on Advanced system settings from the left menu, click on Environment Variables, there you will see user defined variable called Path. Double click on it.

Installation And Setup Terraform On Windows

Now click on New path. Here basically we need to set terraform binaries path where we placed terraform.exe file in C drive. Now, click on Ok and Save the variable.

Installation And Setup Terraform On Windows

Step 4 - Run Terraform command

Now if we run terraform command from cmd from any location, it will work now. Let’s go to terraform_lab folder on the desktop and run the command. It’s WORKING!

Installation And Setup Terraform On Windows

Awesome! It’s very simple installation but step 3 is very important during setup. Otherwise, we can waste lots of time investigating why - 'terraform' is not recognized as an internal or external command while running from CMD.

Happy Learning!


Similar Articles