What is IaC, and why did I learn Terraform?

What is IaC?

IaC stands for Infrastructure as Code, but what does that mean? Let’s say your business uses a virtual machine to host a website. IaC allows you to write configuration file(s) for that infrastructure and run it to create that virtual machine. If you are not using an IaC tool, you would have logged into your service providers (e.g., AWS, Azure, GCP, etc.) web console and created the virtual machine by clicking through a few screens.

Efficient and less prone to human error

Now think of an enterprise environment where 100s’ of virtual machines are created and destroyed regularly. Creating this infrastructure by clicking through multiple configurations screens will be time-consuming and quite likely to introduce human error into the process. However, if you put this process into IaC, you can create and destroy this infrastructure by running the configuration code, and it is guaranteed to be the same every time you run it.

Consistent

As I mentioned above, since the infrastructure configuration is codified, your infrastructure is guaranteed to be the same every time you create using the same configuration code.

Cost-effective

For businesses, doing things as cost-effectively as possible is one of the primary objectives. Since your infrastructure is codified, it is not necessary to have a backup infrastructure running at all times in case the primary infrastructure fails. You can run your IaC code to create new infrastructure in a matter of minutes. Hence, as a business, you can use IaC to save on Disaster recovery costs.

Automation

Now that the infrastructure configuration is codified, it can be easily integrated into a CI/CD pipeline to automate the creation and destruction of the infrastructure.

Why I learnt Terraform

Terraform is an IaC tool provided by Hashicorp. Terraform is a cloud-agnostic solution, so you can use it to manage infrastructure in any cloud provider. Terraform has multiple editions, and one of them is free, and the open-source community heavily supports it. Therefore, I can learn one tool and manage infrastructure in multiple cloud environments.

HCL, Terraforms language is declarative; hence, you can declare the end state of the infrastructure and terraform will take the necessary steps to create the infrastructure. Terraform shows and allows you to review the steps it will take to create the infrastructure and the infrastructure your configuration code will create before creating it.

Terraform has a concept called state file. The state file keeps track of the present state of the infrastructure your configuration code has created. This makes collaboration between team members to create infrastructure simple and easy.

If you work with infrastructure and aren’t using Terraform, I encourage you to have a look at Terraform.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Basitha Gamage

Basitha Gamage

A Digital Engineering Consultant in the making. Absolutely fascinated about cloud computing, and what technology holds for us in the future.