Quantcast
Channel: Cloud Training Program
Viewing all articles
Browse latest Browse all 1906

Terraform Installation Overview

$
0
0

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.

Terraform supported OS

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 ^

There are a couple of steps you need to perform to install this on your Windows machine:

  1. Download the terraform Executable File (.exe) by visiting here and select 32-bit or 64-bit according to your machine.
    Download Terraform for Windows
  2. Extract the downloaded .zip folder containing the terraform executable file and copy the file.
  3. 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”.
  4. Copy the path of the executable file, in my case it is “C:\Program Files (x86)\Terraform”.
  5. 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“.
    add variable path
  6. Click on “Environment Variables…“, select “Path” in the pop-up and click on “Edit“.
    setting environment
  7. Paste the copied path by clicking on New and then click OK
    new env variable
  8. 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.
    terraform version

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)"

install homebrew on mac

Once Homebrew is installed, install terraform using the below command:

% brew install terraform


install terraform on mac using brew

To confirm the installation, type terraform -v and you will get the current version as the output.

Installing Terraform on Linux ^

  1. Download the terraform Zip File by visiting here and select 32-bit or 64-bit according to your machine.
  2. 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).
  3. Move the extracted terraform file to /usr/local/bin/ using the command: $ sudo mv terraform /usr/local/bin / 
  4. 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.

Terraform in vscode

After it has been installed, to verify the installation open Terminal and type:

terraform -v

terrafrom install in vscode

 

Related/References

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!

Install terraform

The post Terraform Installation Overview appeared first on Cloud Training Program.


Viewing all articles
Browse latest Browse all 1906