Install Terraform
Terraform can be installed from the Terraform website download page. You can also install it using your system package manager. The Terraform installation manual contains the essential information for a proper installation.
We cover here the basic steps for Linux, MAC and Windows for convenience. Refer to the official Terraform documentation if needed.
- MacOS
- Linux
- Windows
Terraform can be easily installed on MacOS using brew. All you need to do is two run the two commands displayed below:
brew tap hashicorp/tap
brew install hashicorp/tap/terraform
If everything went as expected, now you should be able to run Terraform commands. Let's see the version of your Terraform installation:
terraform -version
# If Terraform is installed, you should see the a similar output
Terraform v1.7.3
on darwin_arm64
Here are the steps to install Terraform on Linux based on the Terraform documentation.
wget -O- https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /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
Note that the Terraform documentation also covers other methods to install Terraform on Linux.
Install Chocolatey​
To install Chocolatey on Windows, we follow the official Chocolatey website instructions.
- Run PowerShell as Administrator
- Check if Get-ExecutionPolicy is restricted
Get-ExecutionPolicy
If it is restricted, run the following command:
Set-ExecutionPolicy AllSigned
- Install Chocolatey
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
Note: You might need to restart PowerShell to use Chocolatey
Install Terraform with Chocolatey​
Once you've installed Chocolatey on Windows, installing Terraform is as simple as can be:
choco install terraform
Find the product key​
Write the following in Command Prompt (run as administrator):
wmic path SoftwareLicensingService get OA3xOriginalProductKey
Find Windows license type​
Write the following in Command Prompt:
slmgr /dli