An Easy Guide to Install Terraform on Windows

With Terraform, you can now define, deploy, and manage your infrastructure efficiently.

Terraform has become an essential tool for infrastructure as code (IaC), allowing developers and operations teams to automate the provisioning and management of infrastructure resources. If you are a Windows user looking to harness the power of Terraform, you're in the right place. 

In this blog, I will walk you through the step-by-step process of installing Terraform on Windows.


Before you begin, make sure that you have the following prerequisites:

  • A Windows 10 or 11 PC with 64-bit architecture
  • Administrator privileges on your Windows machine

Installing Terraform on Windows

To install Terraform on Windows, you have to download and extract the correct Terraform package.

Download and Extract Terraform on Windows

Navigate to the Terraform download page. It should list out Terraform downloads for various platforms. Navigate to the Windows section and download the respective version. I have a 64-bit Windows machine, so I will download the AMD64 file. Click on download, and the process will start automatically. For this example, I am downloading V1.6.5, this will download the file -

Install Terraform

Extract the downloaded Terraform zip archive to a directory of your choosing (for example, C:\terraform). You can use a built-in Windows utility or a third-party extraction tool like 7-Zip.

Update Path Environment Variable

The Path Environment Variable is a list of where the PowerShell, Command Prompt, or Git Bash will look to find a command. If you input a command and it is not in the Path Environment Variable list, then the command will not be recognized.

To add the Terraform folder in the Path Environment Variable, click on the Start Menu and search for the environment variables option.

Edit the system Environment Variables
Search For Environment Variables

Open the "Environment Variables" window by searching for it in the Start menu. 

Windows environment variables
Windows Environment Variables

Navigate to the "User variables" tab and click "New." 

In the "Variable name" field, enter "TERRAFORM_HOME." 

In the "Variable value" field, specify the path to the extracted Terraform directory (e.g., C:\terraform). 

Click "OK" to save the new variable.

Or, the easy way is to add it as a system variable. Navigate to the "System variables" tab and click "Edit."

Edit Windows System Variables
Edit Windows System Variables

Select the "Path" variable and click "Edit." 

Append the path to the Terraform executable to the end of the variable value (e.g., C:\terraform\terraform.exe). Separate the new path from the existing paths using a semicolon (;).

Click "OK" to apply the changes.

Verify Windows Terraform Installation

Open a Command Prompt or PowerShell to check if Terraform is correctly added to the environmental variable PATH. Run the terraform command. 

C:\users\admin\teraform> terraform

You will see an output similar to the one shown below.

Terraform on Windows
Terraform on Windows

 Enter the command terraform -version to check the Terraform version. This should display the version of Terraform you just installed, as shown below:

C:\users\admin\teraform> terraform -version

Terraform v1.6.5
on windows_amd64

How to Create AWS EC2 Instance Using Terraform

To create an AWS EC2 instance using Terraform, get the AWS access key ID and secret access key. You can create these in the AWS Management Console under IAM (Identity and Access Management).

Next, open a command prompt and set your AWS credentials as environment variables:

setx AWS_ACCESS_KEY_ID "your-access-key-id"
setx AWS_SECRET_ACCESS_KEY "your-secret-access-key"

Create a directory for your Terraform files in any Windows drive of your choice, preferably where Teaforrm is installed (C drive). Inside this directory, create a Terraform configuration file and add the below configurations:

provider "aws" {
  region = "us-east-1" 
resource "aws_instance" "example" {
  ami           = "ami-0c55b159cbfafe1f0"  
  instance_type = "t2.micro"

This configuration creates an EC2 instance using a specific Amazon Machine Image (AMI) and instance type.

Open a command prompt in the directory where your Terraform configuration file is located.

Run the following commands to initialize Terraform.

terraform init

Run the following commands to apply the configuration:

terraform apply

Terraform will download the necessary provider plugins and prompt you to confirm the creation of the resources. Type "yes" to proceed.

Once Terraform completes the provisioning, it will output information about the created resources, including the public IP address of the EC2 instance. You then connect to the EC2 instance using SSH or any other method appropriate for your instance and operating system.


Congratulations! You've successfully installed Terraform on your Windows machine. With Terraform, you can now define, deploy, and manage your infrastructure efficiently. Dive into Terraform's documentation to discover the full potential of Infrastructure as Code. Happy coding!

Are you looking to polish your Terraform skills in a real-world environment? Explore our comprehensive Terraform for Beginners Course for hands-on learning. The course covers all of Terraform fundamentals using video lectures, interactive exercises, and hands-on labs to help you internalize concepts and commands.

If you found this article interesting, consider sharing it on your socials, and check out our Terraform courses:

HashiCorp : Terraform Cloud | KodeKloud

Or, test your expertise with our challenges:

Terraform Challenges | KodeKloud