Introducing the Terraform IaC tool

by Daniel Pham
Published: Updated:

In this article, I will introduce to you the IaC Terraform tool. So what is Terraform? And why do we need to use this tool? Let’s talk about how to use Terraform first. I will present those things in the next articles.

What is Terraform?

Terraform is an open source tool created by HashiCorp. It allows you to: define, deploy and manage your infrastructure through lines of code (IaC).

Terraform can work with public cloud infrastructures such as AWS, GCP, Azure, Digital Ocean,… It can also work with private cloud infrastructures such as OpenStack, VMWare.

This allows you to flexibly use Terraform to manage infrastructure located on different infrastructure platforms, which we call hybrid infrastructure.

Why was Terraform born?

This is a long story but I can summarize it through some small sections as follows.

Sysadmin manually

Previously, system administrators (Sysadmins) had to install infrastructure manually. They have to install each server, install each database, install each network device,… And everything is done manually. That brings huge risks such as: errors in implementation, differences between installations, insynchronization between environments,…

Sysadmin script

Over time, Sysadmins have gone one step further and used scripts. The purpose is to partially automate the IT infrastructure installation process. Using scripts such as Bash script, Shell script, Python script, etc. helps reduce errors. However, it still has disadvantages:

  • Even though using scripts, Sysadmin still has to go to each server and each device to run the script. This will become very time consuming if the number of devices is very large, thousands of devices and servers.
  • Difficult to manage versions. If you have used scripts then you know script version management is not easy either. Sysadmins can name scripts like,, etc. However, it can still cause mistakes when using the wrong script.
  • Difficult to use for a team, especially a large team. Because it is difficult to manage script versions plus many people use it in the team. Mistakes are completely possible.

Sysadmin becomes DevOps

Introducing the Terraform IaC tool
Introducing the Terraform IaC tool. Source: photo taken from Terraform homepage.

DevOps culture was born. At this time, the work and environment require Sysadmins to automate everything as much as possible. To do this, using scripts is not enough.

The work of deploying infrastructure and removing development infrastructure takes place continuously in the product development environment. Automate infrastructure combined with product development CI/CD processes. Reduced to 3 basic requirements:

  • Automate everything
  • Fast, few errors
  • Do it continuously

At this point, HashiCorp has launched Terraform. A tool written in HCL (HashiCorp Configuration Language). It allows Sysadmins/devops to perform the above job requirements. So life becomes easier even though we have to hustle harder.

In the above section you read a phrase called IaC. So what is it?

IaC – Infrastructure as Code. This is the term used to describe tools similar to Terraform. Tools that allow you to declare, deploy, and manage IT infrastructure with lines of code and commands. At this point, you also imagine that DevOps engineers will have to learn a little about programming, right?

However, the programming of DevOps engineers will be a little different from that of regular developers. What DevOps aims at is automatic programming of systems/infrastructure. Not programming to write applications, write websites,…

What are the ideas for using Terraform at work?

Having said all that, you should at least have an idea of how to use this tool. Of course, this article does not go into detail about using Terraform. But let’s raise the idea to see if it’s okay.

Work environment

To say how to use it, we first need to see what environment it is in. DevOps tools in general and Terraform in particular are currently not suitable for normal businesses and organizations.

It is only suitable for businesses specializing in IT, large and medium-sized businesses that have a relatively complete IT infrastructure.

Where there are full teams: Developer, Tester, Sysadmin, DevOps,… When the environment has relatively enough teams to develop and operate IT products, then the DevOps culture can be applied. More specifically, only then can DevOps tools be used.

You will not be able to enter a painting production company with a scale of 20 people. Having only one IT Support and saying they want to apply DevOps, that is impossible.

Job requirements

  • Boss: wants the product to be launched quickly and stably to the market. Overall “delicious.”
  • Developer: wants to build apps quickly without using any hands or feet. DevOps “takes care of everything”.
  • Sysadmin/DevOps: must automate everything as much as possible. But one day, the Developer builds the app 10 times but builds it manually 10 times and gets frustrated.

Team size

  • The DevOps team has about 3-5 people. Large companies can have much larger teams.
  • How do people use each other’s resources? The infrastructure architecture designed by Mr. Lead, how can Member fresher deploy it?
  • If Mr. Lead quits his job and goes to another company, how will the whole team know what he did with the infrastructure?
  • For example, if the infrastructure is deployed in January, then in August there is a request to continue deploying it, what should we do? At that time, search for old implementation documents or do it over and over again from scratch?
  • etc…

How to operate the team

From job requirements to DevOps team requirements, you can also realize that there will be many problems occurring in a team.

So, the idea to run a DevOps team is as follows. This is when you will see Terraform appear.

Part 1: Lead does everything
  1. Team Developer requires a dev environment and a production environment. Identical in infrastructure, only different in size.
  2. Mr. Lead the DevOps team after receiving the request, ok. He creates a repository on Github to store the Terraform code he will write.
  3. Next, Mr. Lead added the entire DevOps team to this repository.
  4. After that, Mr. Lead started using Terraform to write code to deploy the environment as required. Because the two environments have exactly the same architecture, it works quite well. He wrote code for the dev environment and pushed it to the dev branch. Then he copied the code, changed the size parameters a bit and pushed the code to the master branch.
  5. So now, Mr. Lead can git clone the code from the repository and apply. After 1 minute and 30 seconds, the 2 environments are ready.
Part 2: The whole DevOps team works together
  1. However, Mr. Lead cannot keep doing that forever. You also have to leave this job to other members to do. But every time I apply Terraform, I have to clone it and then type the apply command, which seems like a waste of time.
  2. So Mr. Lead used the CI tool Jenkins to automatically apply Terraform every time there was a change to the code. Now that I’m better, the DevOps team just needs to write Terraform code on the machine. Push the new code to the repository and Jenkins does everything else. Finished.
  3. At this point, Lead’s work is a bit better. Members will write Terraform code and push it to the repository. Mr. Lead just needs to review the changed code and merge it into the repository if it’s okay. Everything is automatic after that and done.
  4. Half a year later, the Developer team requested to change the environment a bit. Simply, the member will change the Terraform code a bit and that’s it. Everything is like step 8 above.

Here you can see that:

  1. DevOps teams work to almost automate the deployment of IT infrastructure.
  2. The entire team can use the same Terraform resource.
  3. There is inheritance in the team. Even if Lead retires, the team can still rely on that Terraform code to automatically redeploy the infrastructure. No fear of errors or missing components in the system.

That’s the idea. I hope you find that what I wrote is not too long.


Through this article, I have basically introduced to you what Terraform is and what purpose it is used for. The IT industry has entered a period of high automation, requiring Sysadmin or DevOps engineers to automate their work. In the next articles, I will talk more specifically about how to use Terraform.

0 0 votes
Article Rating

You may also like

Notify of
Inline Feedbacks
View all comments

DevOps Lite is a personal blog specializing in technology with main topics about DevOps, DevSecOps, SRE and System Administrator. Articles are shared for free and contributed to the community.



Subscribe my Newsletter for new blog posts. Stay updated from your inbox!

© 2021-2024 – All rights reserved.

Please write sources “” when using articles from this website.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More

Would love your thoughts, please comment.x

Adblock Detected

Please support us by disabling your AdBlocker extension from your browsers for our website.