Skip to main content

Command Palette

Search for a command to run...

DevOps (Day: 60) Terraform Infrastructure as a code

Day 60:#90DaysOfDevOpsChallenge

Published
4 min readView as Markdown
DevOps (Day: 60) Terraform Infrastructure as a code

Task-01

Install Terraform on your System (AWS).

Task-02

Various Answers in Terraform:- IAC,Resources, Providers,state file & Desired and Current state.

Terraform Architecture

No alt text provided for this image

Terraform Architecture Diagram.

What is Terraform?

No alt text provided for this image

Terraform is an infrastructure as code (IAC) tool that allows you to create the manage, and update infrastructure resources such as virtual machines, networks and storage in a repeatable,scalable and automated way.

Task-01

Install the Terraform on your system:

Create an EC2 intance.

No alt text provided for this image

Create an EC2 intance Diagram.

Now SSH into you ubuntu EC2 instance.

No alt text provided for this image

Now SSH into you ubuntu EC2 instance Diagram.

Download the appropriate package for your system form the offical Terraform website (https://www.terraform.io/downloads.html).

Select the Linux as the operating system and ubuntu as the package manager.

Copy and paste below 3 Commands to instance terminal, you can direct copy here:-

No alt text provided for this image

Copy and paste below 3 Commands to instance terminal, you can direct copy here Diagram.

Install Terraform by running the following command:

No alt text provided for this image

Install Terraform by running the following command Diagram.

No alt text provided for this image

Install Terraform by running the following command Diagram.

Verify the Terraform is installed correctly by running the following command:

terraform --version

No alt text provided for this image

Verify the Terraform is installed correctly by running the following command Diagram.

Task -02

Answer the below questions.

Why we use Terraform?

Terraform is a tool for building.changing and versioning infrastructure in a safe,repeatable way. It enables teams to manage infrastructure as code, providing a single resource of truth for the instance and ensuring that it is always in the desired state. Terraform can be used to manage infrastructure across multiple cloud providers and on premises infrastructure, and its supports a wide range of resource types.

No alt text provided for this image

Why we use Terraform Diagram.

What is Infrastructure as a Code (IAC)?

Infrastructure as Code (IAC) is a practice of managing and provisioning infrastructure using code instead of manual processes. By treating infrastructure as code, teams can version control their infrastructure, automate the provisioning and improve collabration between different teams. IAC enables teams to make changes to infrastructure in a safe and repeatable way, and it helps to reduce the risk of human error and inconsistencies.

No alt text provided for this image

What is Infrastructure as a Code (IAC) Diagram.

What is Resources?

In Terraform, a resource is a declarative representation of a component in a cloud infrastructure, such as a virtual machine, database, or network interface. Resources define the desired state of the component, and Terraform uses the resource definition to create, modify, or delete the component as needed.

No alt text provided for this image

What is Resources Diagram.

What is Provider?

In Terraform, a provider is a plugin that interfaces with a specific cloud infrastructure provider or service. Providers define the resources that Terraform can manage, as well as the methods for creating, updating, and deleting those resources. Examples of providers include AWS, Google Cloud, and Microsoft Azure.

No alt text provided for this image

What is Provider Diagram.

What is State file in terraform? What is the importance of it?

The Terraform state file is a json file that stores the state of the infrastructure managed by Terraform. it includes information about the resource that have been created their current state and any deployment between them, The state file is critical to Terraform operations as it is used to plan and execute changes to the infrastructure.

No alt text provided for this image

What is State file in terraform? What is the importance of it Diagram.

What is Desired and Current State?

In Terraform, the desired state is the state that you want your infrastructure to be as defined in your Terraform Configuration files. The current state is the actual state of the infrastructure as represented in the Terraform state file. When you run the Terraform apply . Terraform compares the desired state with the current state and makes changes as needed to bring the infrastructure into the desired state.

Thank you for reading!! Hope you find this helpful.

#day60challenge#90daysofdevops

Always open to suggestions..!!

~ Manoj Bhamidipati 🙂