Home Blog Page 2

Introduction to Terraform


What Is Terraform?

Terraform is an open source infrastructure as code tool. HashiCarp has developed it.

Terraform is used by almost all experts/engineers to create any cloud infrastructure. Terraform is go to tool for all the Cloud Engineers.

Below are the key benefits of terraform 

  • We can codify our application infrastructure
  • An infrastructure that can be easily reproduced using terraform.
  • We can version control infrastructure, it can be kept securely and safely.

Why Terraform is so Popular?

Currently terraform is go to tool for any infrastructure provisioning tasks.

Below are the main reasons

  • Free to use.
  • Terraform is declarative language.
  • Learning curve is very short.
  • Once you learn terraform, it is easy to provision infrastructure in other cloud providers with minimal effort.
  • Syntax is same for other providers.
  • We can create Immutable infrastructure.
  • Once you don’t need infrastructure, we can destroy infrastructure. Which will save the cost for IT resources.
  • Terraform is master and agent less compared to other tools. Which saves costs.

How to install Terraform on laptop?

In order to install terraform please download appropriate package for your system as zip.

Steps to install on Mac/Linux

  • Unzip terraform
  • In order to move the terraform binary use command “mv terraform /usr/local/bin/”
  • In order to verify installation, run command “terraform -help”

Steps to install on Windows

  • Run terraform.exe to install terraform.
  • Go to Control Panel -> System -> System settings -> Environment Variables.
  • Scroll down in system variables until you find PATH.
  • Click edit and change accordingly.
  • BE SURE to include a semicolon at the end of the previous as that is the delimiter, i.e. c:\path;c:\terraform
  • Launch a new console for the settings to take effect.
  • In order to verify installation, run command “terraform -help”

What are all the basic commands of Terraform?

Below are main commands used in terraform

  • terraform init
    • This is the first command we run in terraform.
    • Command is used to initialise directory containing Terraform configuration files.
    • Command will automatically find, download, and install the necessary provider plugins mentioned in the configurations.

  • terraform fmt 
    • Command is used to rewrite Terraform configuration files to a canonical format and style.
    • It does linting
    • It makes code more readable format

  • terraform plan
    • Command creates an execution plan.
    • Checks the current status with the existing backend / local state file.
    • Indicates any differences between the current infrastructure and the current code.
    • This is just a dry run, it doesn’t actually create any resources.

  • terraform apply
    • This command actually creates all the resources referenced in the Terraform configuration files.
    • Depending on the number of resources, it will take time to create those resources.

  • terraform destroy
    • Command is a convenient way to destroy all resources managed by the Terraform configuration.
    • This process is irreversible. Once the command is run, Terraform starts to destroy all resources.

Reference urls of Terraform



Main Cloud Service Provider as of 2023

PostionCSPGA for publicLogo
1AWS (Amazon Web Services)14th-Mar-2006
2Microsoft Azure27th-Oct-2008
3GCP (Google Cloud Platform)07th-Apr-2008
4OCI (Oracle Cloud Infrastructure)20th-Oct-2016

Before Cloud Computing era


Before, cloud computing companies used to have their own data centres. Companies used to have mainly two types of expenditure on servers, Capex & Opex.

CapeX(Capital Expenditure) 

  • In order to purchase the servers, it was quite expensive. Even renting wasn’t an option either, As it was also quite expensive.
  • Once a purchase order is placed for the servers, it takes a couple of months of lead time to get the servers into companies data centres.
  • It was required to maintain specific temperature for these servers and hence we used to place these servers in a separate room or a building with controlled temperature.

 OpeX(Operational Expenditure)

  •  In order to maintain these  servers,  we would require 24/7 power supply and air conditioning.
  • Separate admin team was required to setup, configure and maintain these  servers.
  • In case of any issues with the servers there was an outage/downtime on application. If application is down then business is down and hence loss to companies business.

What is Cloud Computing ?


Cloud computing doesn’t mean computers are in the cloud. It is actually on a safe, secure location. We call it a data centre.

 Cloud Computing, Is On Demand delivery of IT resources. We just need a laptop/Desktop and internet connection to access it.

 Pay-as-you-go pricing, We pay for what we use. If you don’t want to use Cloud IT resources before 8 a.m. or after 5 p.m. or during the weekend then delete resources whenever after using IT resources. 

Whenever IT resources are required, Just create it via automation.There is no capex or opex cost involved here. No need to buy or maintain the servers.