Terraform Curriculum
On this page
- Install Windows
- Prerequisites
- Method 1: Using Chocolatey (Recommended for Windows)
- Step 1: Install Chocolatey
- Step 2: Install Terraform
- Step 3: Verify the installation
- Updating Terraform with Chocolatey
- Method 2: Using winget (Built into Windows 10/11)
- Method 3: Manual Installation
- Step 1: Download Terraform
- Step 2: Extract the zip file
- Step 3: Add Terraform to your PATH
- Step 4: Verify the installation
- Step 5: Clean up
- Method 4: Windows Subsystem for Linux (WSL) — Strongly Recommended
- Step 1: Enable WSL
- Step 2: Set up Ubuntu
- Step 3: Update Ubuntu
- Step 4: Install Terraform inside WSL
- Step 5: Access your Windows files from WSL
- Step 6: Using VS Code with WSL
- Recommended Terminal for Windows Terraform Work
- Installing the AWS CLI on Windows
- Verifying Everything Works
- Comparing Installation Methods on Windows
- Common Issues on Windows
- Issue: "terraform is not recognized as an internal or external command"
- Issue: PowerShell execution policy error
- Issue: "Access is denied" during installation
- Issue: Terraform works in Command Prompt but not in PowerShell (or vice versa)
- Summary
Install Windows
Terraform runs perfectly well on Windows. There are several ways to install it, and we will walk through each one clearly. We will also cover the recommended approach for DevOps engineers on Windows — using Windows Subsystem for Linux (WSL) — which gives you a real Linux environment inside Windows, making it much easier to work with Terraform and other DevOps tools.
Installation methods covered in this file:
- Using Chocolatey (Windows package manager — recommended for Windows users)
- Using winget (built-in Windows package manager)
- Manual installation (download and set up manually)
- Using WSL (Windows Subsystem for Linux) — strongly recommended for DevOps work
Prerequisites
- Windows 10 (version 1903 or later) or Windows 11
- Administrator access for some installation methods
- Internet connection
Method 1: Using Chocolatey (Recommended for Windows)
Chocolatey is the most popular package manager for Windows. It works similarly to apt on Ubuntu or brew on macOS. If you do DevOps work on Windows, Chocolatey is worth having.
Step 1: Install Chocolatey
Open PowerShell as Administrator (right-click PowerShell → "Run as Administrator") and run:
After installation, close and reopen PowerShell (as Administrator again), then verify:
Step 2: Install Terraform
Chocolatey will download and install Terraform automatically.
Step 3: Verify the installation
Close and reopen PowerShell (not as administrator this time), then:
Expected output:
Updating Terraform with Chocolatey
Method 2: Using winget (Built into Windows 10/11)
winget is Microsoft's official package manager, built into Windows 10 (version 1809+) and Windows 11. No installation required.
Open Command Prompt or PowerShell and run:
Verify:
To upgrade later:
Method 3: Manual Installation
Use this method when you cannot use a package manager or need a very specific version.
Step 1: Download Terraform
- Open your browser and go to: https://releases.hashicorp.com/terraform/
- Click on the latest version (e.g.,
1.6.6) - Download the file:
terraform_1.6.6_windows_amd64.zip
Or download directly from PowerShell:
Step 2: Extract the zip file
This creates a folder C:\terraform containing the terraform.exe file.
Step 3: Add Terraform to your PATH
This step is important — without it, Windows won't know where to find the terraform command.
Option A: Through the GUI (easy)
- Press
Win + R, typesysdm.cpl, press Enter - Go to the Advanced tab → click Environment Variables
- Under System variables, find Path and click Edit
- Click New and add:
C:\terraform - Click OK on all dialogs
- Close and reopen Command Prompt or PowerShell
Option B: Through PowerShell (faster)
Close and reopen PowerShell after running this.
Step 4: Verify the installation
Step 5: Clean up
Method 4: Windows Subsystem for Linux (WSL) — Strongly Recommended
If you are doing serious DevOps work on Windows, WSL (Windows Subsystem for Linux) is the best approach. Here is why:
- Most DevOps tools (Terraform, kubectl, Helm, AWS CLI, Docker, etc.) are designed for Linux/macOS
- Shell scripts and bash commands in tutorials and documentation are written for Linux
- WSL gives you a full Ubuntu (or other Linux distro) environment inside Windows
- You can use the exact same commands and workflows as Linux DevOps engineers
Step 1: Enable WSL
Open PowerShell as Administrator and run:
This installs WSL2 with Ubuntu by default. Restart your computer when prompted.
If you already have WSL but want to make sure you have WSL2:
Step 2: Set up Ubuntu
After restart, Ubuntu will open automatically and ask you to create a username and password. This is your Linux user — choose something easy to remember.
Step 3: Update Ubuntu
In the Ubuntu terminal:
Step 4: Install Terraform inside WSL
Now follow the Linux installation steps from the install-linux.md file. Inside WSL, you are running a full Ubuntu system, so the Linux instructions apply exactly.
Quick version for Ubuntu in WSL:
Step 5: Access your Windows files from WSL
Your Windows drives are accessible inside WSL at /mnt/:
C:\drive →/mnt/c/D:\drive →/mnt/d/
To navigate to your Windows Desktop from WSL:
However, it is recommended to keep your Terraform project files in the Linux filesystem (~/projects/) rather than the Windows filesystem for better performance.
Step 6: Using VS Code with WSL
VS Code has excellent WSL integration. To open VS Code from WSL:
VS Code will open on Windows but will be connected to the WSL filesystem. This gives you the best of both worlds — a Windows GUI with a Linux backend.
Recommended Terminal for Windows Terraform Work
Regardless of which installation method you use, we recommend installing Windows Terminal from the Microsoft Store. It supports multiple tabs (PowerShell, Command Prompt, WSL) in one window and is much better than the default terminals.
Install from PowerShell:
Installing the AWS CLI on Windows
You will need the AWS CLI for the next chapter on provider authentication.
Using winget:
Manual installation:
- Download the installer from: https://awscli.amazonaws.com/AWSCLIV2.msi
- Run the installer
- Verify:
Inside WSL:
After installing, configure AWS credentials:
Enter your:
- AWS Access Key ID
- AWS Secret Access Key
- Default region (e.g.,
us-east-1) - Output format (
json)
Verifying Everything Works
After installation, run these checks:
Check Terraform:
Quick initialization test:
If terraform init completes successfully, your installation is working.
Comparing Installation Methods on Windows
Our recommendation: If you plan to do serious DevOps work on Windows, set up WSL and do everything inside it. You will have a much smoother experience with all DevOps tools, not just Terraform.
Common Issues on Windows
Issue: "terraform is not recognized as an internal or external command"
Cause: Terraform's directory is not in your PATH.
Fix:
- Find where terraform.exe is located
- Add that directory to your System PATH (see Step 3 in the manual installation above)
- Restart your terminal
Issue: PowerShell execution policy error
Fix:
Issue: "Access is denied" during installation
Fix: Run PowerShell or Command Prompt as Administrator (right-click → "Run as Administrator").
Issue: Terraform works in Command Prompt but not in PowerShell (or vice versa)
Fix: Open a new terminal window after adding to PATH. Changes to environment variables don't apply to already-open terminal windows.
Summary
- Windows has multiple good options for installing Terraform: Chocolatey, winget, and manual
- Chocolatey is the most convenient for Windows users who want easy updates
- winget is the simplest option since it is built into Windows 10/11
- WSL (Windows Subsystem for Linux) is the strongly recommended approach for serious DevOps work — it gives you a full Linux environment inside Windows
- Always verify installation with
terraform version - Install the AWS CLI alongside Terraform — you will need it for authentication in Chapter 6
- Use Windows Terminal for a better terminal experience on Windows
In the next chapter, we move to setting up providers — starting with how to configure and authenticate with AWS.