Skip to main content

Command Palette

Search for a command to run...

Introduction to Terraform and Terraform Basics

Published
2 min read
M

I am a DevOps Engineer at Fidelity National Information Services and responsible to automate the manual things and create CI/CD pipelines in software development lifecycle.

Nowadays, Terraform is the most demanding tool in terms of DevOps.

So, let's discuss about some questions and concepts regarding terraform.

What is Terraform and how can it help you manage infrastructure as code?

Terraform is an IAAC ( Infrastructure As A Code ) tool which used to build and change infrastructure.

It helps us to manage infrastructure as code in the following ways:

1) Scope - Identify the infrastructure for your project.

2) Author - Write the configuration for your infrastructure.

3) Initialize - Install the plugins Terraform needs to manage the infrastructure.

4) Plan - Preview the changes Terraform will make to match your configuration.

5) Apply - Make the planned changes.


Why do we need Terraform and how does it simplify infrastructure provisioning?

Terraform helps to autmomate the infrastructure with the help of terraform configuration files.

It reduces :

i) cost

ii) human errors etc.

It makes infrastructure provisioning Simple and Fast. With a simple configuration file, we can manage multiple projects. Terraform increases the speed of creating infrastructure, and automation.


How can you install Terraform and set up the environment for AWS, Azure, or GCP?

Installation:

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

Explain the important terminologies of Terraform with the example at least (5 crucial terminologies).

1) Provider -

A provider is a plugin that lets Terraform manage an external API.


2) Resource -

Resources are the most important element in the Terraform. Each resource block describes one or more infrastructure objects, such as virtual networks, compute instances, or higher-level components such as DNS records


3) Module -

A module is a collection of terraform configuration files in a directory.


4) Variable -

Variables in terraforms are used to store reusable values.


5) Output -

Terraform output helps to share data between Terraform configurations and with other tools and automation.


Congratulations, you are now able to move forward with advanced terraform.