Join us

What is Terraform and why your infrastructure should be written as code

1_2we8VUk3kS10icOYOKJ3Zg.jpeg

It is safe to say that it’s a future-proof move for your career to understand more about cloud technologies.

According to a recent Gardner report the cloud market for enterprises has become larger than the on-premises market for the first time in 2020 and it will be double the size of on-premises by 2025. Cloud is infrastructure and being able to understand and control it is very important for every professional in the tech field, especially with the growing DevOps culture.

Amazon web services are, without a question, the leading provider for cloud technologies and, as everything Amazon does, it has bad UI (not to confuse with UX). Since the leader of the market has this issue it gave a license for everyone else to do bad UI too. A lot of times important things are hidden and more often than we would like to admit, we end up spending money on components that we didn’t even know we were using.

By putting together all those things as code you will have more control over what is happening with your environment and also be able to build — or destroy — as needed, this is where Terraform shines.

What is Terraform?

An open-source tool for writing infrastructure as code. It allows you to have your infrastructure defined in declarative configuration files that can be managed with a versioning system, like GIT, to have more control of what you are doing. Being in code means that the description of your cloud environment is centralized for easier reading and opens the possibility of adding tests and validations to it.

I won’t go into a tutorial here, but the getting started page from Terraform is really good (that's where i got the sample above). When I first went trough those tutorials it amazed me how easy it is to create and destroy a whole environment, it made me want to use it for all my projects. Going through configuration files on the cozy space of my IDE (Vim, the best one for obvious reasons), being able to understand the changes over time and even rollback when needed are great features that come free with Terraform. The important thing is that developers understand code better than GUIs, so having all your infrastructure as code facilitates handling and understanding it.

In professional use cases what we do is to have a pipeline that runs when new Terraform code is deployed. On this pipeline, we have a validation step to run Terraform’s own validations and tests with Terratest. Automation is always a good thing and sometimes you even hear that if something is not automated it is not done.

If it is not automated, it is not done — someone

Another good thing about Terraform is that it is cloud-agnostic, you can find connectors to Azure, Google Cloud, AWS and more.

Conclusion

Now you know why having infrastructure as code is so important and why I think Terraform is the best tool for the job. It is so much easier to control what you have on your cloud environments with this strategy than by going through GUIs and crazy UI layouts. Terraform offers all the things you need to get started with infrastructure as code and allows you to have your infrastructure controlled with GIT giving you the opportunity to move back and forward on the changes.

The year is 2022, we need to stop doing so much work by hand and let the machines take over some of our duties. Why not start by letting them create more machines?

Please, if you liked this post, give some claps and share it :)


Only registered users can post comments. Please, login or signup.

Start blogging about your favorite technologies, reach more readers and earn rewards!

Join other developers and claim your FAUN account now!

Avatar

Pedro Henrique

Data Engineer, sebratec

@pedrofullstack
I am a Brazilian data engineer working out of Stockholm. when I am not thinking on ways to move data around, I enjoy riding motorcycles and reading books.
User Popularity
33

Influence

2k

Total Hits

1

Posts

Mentioned tools