TerraformPilot

Terraform

How to Install Terraform on Windows - Complete Setup Guide

Install Terraform on Windows step by step. Covers manual install, Chocolatey, Scoop, and WSL methods plus PATH configuration and verification.

LLuca Berton1 min read
How to Install Terraform on Windows - Complete Setup Guide

Introduction

#

Installing Terraform on Windows is straightforward with several methods available. This guide covers every approach — from manual download to package managers — so you can choose what works best for your workflow.

#

Step 1 - Download Terraform

#
  1. Visit terraform.io/downloads
  2. Download the Windows AMD64 zip file
  3. Extract the zip file

Step 2 - Add to PATH

#
  1. Extract terraform.exe to a permanent location (e.g., C:\terraform)
  2. Open System Properties > Environment Variables
  3. Under System Variables, find Path and click Edit
  4. Click New and add C:\terraform
  5. Click OK to save

Step 3 - Verify

#

Open a new Command Prompt or PowerShell:

terraform version

Method 2 - Chocolatey

#
# Install Chocolatey (if not installed)
Set-ExecutionPolicy Bypass -Scope Process -Force
iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
 
# Install Terraform
choco install terraform
 
# Verify
terraform version
 
# Update later
choco upgrade terraform

Method 3 - Scoop

#
# Install Scoop (if not installed)
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
irm get.scoop.sh | iex
 
# Install Terraform
scoop install terraform
 
# Verify
terraform version
 
# Update later
scoop update terraform

Method 4 - winget

#
# Install via Windows Package Manager
winget install Hashicorp.Terraform
 
# Verify
terraform version

Method 5 - WSL (Windows Subsystem for Linux)

#

If you prefer a Linux environment on Windows:

# In WSL Ubuntu
sudo apt-get update
sudo apt-get install -y gnupg software-properties-common
 
wget -O- https://apt.releases.hashicorp.com/gpg | \
  gpg --dearmor | \
  sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg > /dev/null
 
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] \
  https://apt.releases.hashicorp.com $(lsb_release -cs) main" | \
  sudo tee /etc/apt/sources.list.d/hashicorp.list
 
sudo apt-get update
sudo apt-get install terraform
 
terraform version

Enable Autocomplete (PowerShell)

#
terraform -install-autocomplete

IDE Setup

#

VS Code Extension

#
  1. Open VS Code
  2. Install "HashiCorp Terraform" extension
  3. Enjoy syntax highlighting and autocomplete

Verify Installation

#
# Check version
terraform version
 
# Test with a simple config
mkdir test-terraform
cd test-terraform
 
# Create main.tf
@"
terraform {
  required_providers {
    local = {
      source = "hashicorp/local"
    }
  }
}
 
resource "local_file" "hello" {
  content  = "Hello, Terraform on Windows!"
  filename = "hello.txt"
}
"@ | Out-File -FilePath main.tf -Encoding UTF8
 
terraform init
terraform apply -auto-approve
Get-Content hello.txt
terraform destroy -auto-approve

Hands-On Courses

#

Conclusion

#

You now have Terraform installed on Windows. Whether you chose manual installation, Chocolatey, Scoop, or WSL, you are ready to start building infrastructure as code.

#Terraform#DevOps#Infrastructure as Code

Share this article