Terraform is an open-source infrastructure as code software tool created by HashiCorp. It enables the users to define and provision a data center infrastructure of different cloud providers using a high-level configuration language known as Hashicorp Configuration Language (HCL), or optionally JSON but first, we need to do Terraform installation. It is supported by many operating systems.
This blog post covers the basic installation of terraform on different Operating Systems and a very powerful text editor given below:
- Terraform Installation on Windows
- Install Terraform on macOS
- Installing Terraform on Linux
- Installing Terraform on Visual Studio Code
Terraform Installation on Windows ^
There are a couple of steps you need to perform to install this on your Windows machine:
- Download the terraform Executable File (.exe) by visiting here and select 32-bit or 64-bit according to your machine.
- Extract the downloaded .zip folder containing the terraform executable file and copy the file.
- Create a new Terraform directory and paste the file, this directory can be anywhere on your machine. I would recommend pasting in “C:\Program Files (x86)\Terraform”.
- Copy the path of the executable file, in my case it is “C:\Program Files (x86)\Terraform”.
- Now, we need to set an environment variable that points to this path. Search environment in the windows search bar and select “Edit the system environment variables“.
- Click on “Environment Variables…“, select “Path” in the pop-up and click on “Edit“.
- Paste the copied path by clicking on New and then click OK
- Done!! Now to check if it is installed open command prompt and type terraform -v and you will get the current version as the output.
This completes the terraform installation on Windows.
Installing Terraform on macOS ^
To install terraform on macOS we will first install Homebrew using the below command:
% /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
Once Homebrew is installed, install terraform using the below command:
% brew install terraform
To confirm the installation, type terraform -v and you will get the current version as the output.
Installing Terraform on Linux ^
- Download the terraform Zip File by visiting here and select 32-bit or 64-bit according to your machine.
- Unzip the folder using the command (make sure you are in the correct directory): $ unzip terraform_0.12.26_linux_amd64.zip (file name may change according to the newer versions).
- Move the extracted terraform file to /usr/local/bin/ using the command: $ sudo mv terraform /usr/local/bin /
- Confirm the file has been moved and terraform has been installed using the command: $ terraform -v (if it gives the current version as output then the installation is successful).
Installing Terraform on Visual Studio Code ^
This is an Optional step in Installing Terraform. There are many text editors in the market, we are going to choose Visual Studio Code for this as it is a very powerful text editor and supports all the platforms.
To download the Visual Studio Code, click here.
Once you have downloaded the visual studio code, open it and go to extension and search for terraform and Install it.
After it has been installed, to verify the installation open Terminal and type:
- [AZ-400] Microsoft Azure DevOps Certification Exam: Everything You Need To Know
- [AZ-104] Microsoft Azure Administrator Certification Exam: Everything You Need To Know
- 1Z0-1072-20 | Oracle Cloud Infrastructure 2020 Architect Associate
Join FREE Masterclass
To know about Terraform and what to study Including Hands-On labs you must perform to clear Terraform Certified Associate certification exam by registering for our FREE Masterclass.
Click on the below image to Register Our FREE Masterclass Now!