Terraform Cert Guide Chapter 2: How to Install Terraform Step by Step
Chapter 2 of the book is the “roll up your sleeves” chapter. No more theory about what IaC is or why Terraform exists. Now you actually install the thing and get it running on your machine.
The good news? Terraform is just a single binary. No dependencies, no runtime, no framework to install first. Download it, put it in your PATH, and you’re done. Seriously, that’s it.
Installing Terraform on Windows
The book walks through the Windows install step by step, and it’s pretty simple:
- Go to terraform.io/downloads and grab the Windows package (32-bit or 64-bit, depending on your system)
- Extract the ZIP file somewhere on your machine
- Add the folder containing
terraform.exeto your system PATH
That last step is where people sometimes get stuck. You go to This PC > Properties > Advanced system settings > Environment Variables, find the Path variable under System variables, and add the folder where you put terraform.exe.
Quick shortcut the book mentions: you can just drop terraform.exe into C:\Windows\system32 and skip the PATH setup entirely. That works because system32 is already in your PATH by default.
Once it’s set up, open CMD or PowerShell and run:
terraform --version
If you see a version number, you’re good. If you get “command not found”, your PATH isn’t set correctly.
Installing Terraform on Linux
The Linux installation follows the same pattern but through the terminal. The book uses Ubuntu as the example, but the process is basically identical for CentOS, Red Hat, or any other distro.
Here’s the flow:
# Update your system first
sudo apt update -y
# Create a directory and download Terraform
mkdir terraform && cd terraform
wget https://releases.hashicorp.com/terraform/1.0.0/terraform_1.0.0_linux_amd64.zip
# Install unzip if you don't have it
sudo apt install unzip -y
# Extract the binary
sudo unzip terraform_1.0.0_linux_amd64.zip
# Add to your PATH
export PATH=$PATH:$HOME/terraform
One thing to note: that export PATH command only lasts for the current session. If you close your terminal, it’s gone. For a permanent setup, you’d want to add that line to your ~/.bashrc or ~/.profile file. The book doesn’t explicitly mention this, but it’s worth knowing.
The book has a fun way to verify the install. Instead of just checking the version, it uses terraform console:
echo "1+7" | terraform console
# Output: 8
If Terraform can do math for you, it’s working.
Installing Terraform on macOS
Mac installation is the cleanest of the three:
- Download the macOS package from terraform.io/downloads
- Unzip the file
- Move the binary to your local bin directory:
sudo mv ./terraform /usr/local/bin
That’s it. The /usr/local/bin directory is already in your PATH on macOS, so no extra configuration needed. Verify with terraform -v or terraform -h.
Now, the book was written when Terraform v1.0.0 was the latest. If you’re doing this today, you’d obviously grab whatever the current version is. The process hasn’t changed though.
What the Book Doesn’t Cover (But You Should Know)
The chapter is straightforward about installation, but let me add some context about the plugin architecture and provider system since it’s relevant for the certification exam.
Terraform’s Plugin Architecture
Terraform itself is just the core engine. It doesn’t actually know how to talk to AWS, Azure, GCP, or any other service out of the box. That’s where providers come in.
Providers are separate plugins that Terraform downloads and manages. When you write a Terraform config that says “I want an AWS EC2 instance”, Terraform uses the AWS provider plugin to make the actual API calls to AWS.
This is a smart design choice. It means:
- The core Terraform binary stays small and simple
- Providers can be updated independently from Terraform itself
- Anyone can write a provider for any service
- You only download what you actually need
How Providers Work
When you run terraform init in a project directory, Terraform reads your configuration files, figures out which providers you need, and downloads them automatically. They get stored in a .terraform directory inside your project.
For example, if your config references AWS resources, Terraform will pull down the hashicorp/aws provider. If you also have some Kubernetes resources, it’ll grab hashicorp/kubernetes too.
Each provider has its own version numbering. You can (and should) pin provider versions in your config to avoid surprises:
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 4.0"
}
}
}
The Terraform Registry
All official and community providers live in the Terraform Registry. This is where terraform init downloads them from. There are hundreds of providers covering everything from major cloud platforms to DNS services, monitoring tools, and databases.
For the certification exam, remember: Terraform uses a plugin-based architecture where providers handle the actual interaction with infrastructure APIs. The core binary just orchestrates everything.
My Take on This Chapter
Honestly, this is the thinnest chapter in the book. It’s basically “download a zip file, extract it, add it to PATH” repeated three times for different operating systems. If you’ve ever installed a CLI tool before, you could probably skip this chapter entirely.
But there’s value in understanding that Terraform is a single binary with no dependencies. That simplicity is part of why it became so popular. Compare that to tools that need specific runtimes, package managers, or complex installation procedures. Terraform just works.
The plugin architecture piece is what really matters here from a learning perspective. Knowing that providers are separate, downloadable plugins that handle all the actual cloud API work is fundamental to understanding how Terraform functions as a whole.
Chapter Quiz Highlights
The book includes some practice questions. Here are the key ones:
- How do you check the Terraform version?
terraform --version(notterraform fmtorterraform -psversion) - How do you get help in Terraform? Both
terraform -handterraform -helpwork - Do you need Go installed to run Terraform? No. Terraform is compiled from Go, but you don’t need Go on your machine to use it
That last one trips people up. Terraform is written in Go, but it’s distributed as a compiled binary. You don’t need the Go toolchain at all.
Up Next
Chapter 3 is where the real learning starts. Resources, data sources, variables, outputs, providers in practice. That’s where Terraform goes from “a thing installed on your laptop” to “a tool that actually builds infrastructure.”
Previous: Chapter 1: Getting to Know IaC
Next: Chapter 3: Getting Started Part 1
This is part of a series retelling “HashiCorp Infrastructure Automation Certification Guide” by Ravi Mishra (Packt, 2021). For the full text, grab the book - ISBN: 978-1-80056-597-5.