Check if Terraform is already installed
Open a terminal (macOS/Linux) or Command Prompt / PowerShell (Windows):
terraform versionExample output:
Terraform v1.13.0
If the command is not found, install Terraform for your OS below.
Windows
Option 1 — Chocolatey
choco install terraform
terraform versionOption 2 — Manual install
- Download the Windows zip from the Terraform downloads page.
- Extract
terraform.exe. - Move it to a folder such as
C:\Terraform. - Add
C:\Terraformto your system PATH. - Open a new terminal and run:
terraform versionmacOS
Using Homebrew:
brew tap hashicorp/tap
brew install hashicorp/tap/terraform
terraform versionUbuntu / Linux
sudo apt update
sudo apt 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
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 update
sudo apt install terraform
terraform versionExpected output:
Terraform v1.13.0
Upgrading Terraform
Reinstall with your package manager, or download a newer binary from HashiCorp.
terraform -upgrade is not a version upgrade command. Use it during terraform init -upgrade to refresh providers in an existing project.
Common commands cheat sheet
terraform version # installed version
terraform -help # command help
terraform init # initialize a working directory
terraform plan # preview changes
terraform apply # create or update infrastructure
terraform destroy # destroy managed infrastructureKeep Terraform reasonably up to date. Provider features and AWS APIs move quickly, and old Terraform versions can block newer provider releases.