3 Terraform
Here are the guidelines to install Terraform on Windows, macOS, and Linux.
3.0.1 1. Install Terraform on Windows
3.0.1.1 Using Windows Installer (Recommended)
- Download Terraform:
- Visit the Terraform downloads page.
- Select the Windows version (32-bit or 64-bit) and download the
.zipfile.
- Extract the Terraform Zip File:
- Extract the
.zipfile to a directory (e.g.,C:\terraform).
- Extract the
- Add Terraform to System PATH:
- Open the Start Menu, search for
Environment Variables, and clickEdit the system environment variables. - In the
System Propertieswindow, click theEnvironment Variablesbutton. - In
System Variables, findPath, select it, and clickEdit. - Add the path to the directory where
terraform.exeis located (e.g.,C:\terraform). - Click
OKto close all dialogs.
- Open the Start Menu, search for
- Verify Installation:
Open
Command PromptorPowerShell.Run:
terraform -v
3.0.2 2. Install Terraform on macOS
3.0.2.1 Using Homebrew (Recommended)
Open Terminal.
Run:
brew tap hashicorp/tap brew install hashicorp/tap/terraformVerify Installation:
terraform -v
3.0.2.2 Manual Installation (Alternative)
Download Terraform:
- Visit the Terraform downloads page.
- Select the macOS version and download the
.zipfile.
Extract and Move Terraform:
Extract the
.zipfile.Move
terraformbinary to/usr/local/bin:sudo mv terraform /usr/local/bin/
Verify Installation:
terraform -v
3.0.3 3. Install Terraform on Linux
3.0.3.1 Using Package Repositories (Debian/Ubuntu)
Add HashiCorp GPG Key and Repository:
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add - sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main"Install Terraform:
sudo apt-get update && sudo apt-get install terraformVerify Installation:
terraform -v
3.0.3.2 Using Package Repositories (RHEL/CentOS/Fedora)
Add HashiCorp Repository:
sudo dnf config-manager --add-repo https://rpm.releases.hashicorp.com/RHEL/hashicorp.repoInstall Terraform:
sudo dnf install terraformVerify Installation:
terraform -v
3.0.3.3 Manual Installation (For Other Distributions)
Download Terraform:
- Visit the Terraform downloads page.
- Select the Linux version and download the
.zipfile.
Extract and Move Terraform:
unzip terraform_<version>_linux_amd64.zip sudo mv terraform /usr/local/bin/Verify Installation:
terraform -v
These steps should enable you to install Terraform on Windows, macOS, and Linux systems easily.