DEV Community

Thiago Barreto
Thiago Barreto

Posted on

Terraform = Peace of Mind

Anyone that have had the pain of setting up infrastructure, specially the same infra multiple times (shout out to all software agencies out there), knows how much of a lifesaver Terraform actually is.

As the go-to infra-as-code solution, Terraform brings peace to an arena filled with stress, worry and doubt. Stop taking hours to set up the same thing over and over, no infra team member having all the company's infra knowledge only on their head, no new colleague having no idea what's the company's infra like.

No more infra being something hard to describe.

Here's how Terraform accomplishes all of this (all screenshots are from their AWS "Get Started"):

1. Resources' Description File

Every infra resource is described as a "resource" block. This one is an EC2 instance resource:

Image description

It could be an S3 bucket, or an RDS instance, or all of them together at the same time!

You could create one resource instance for each deployment stage with a for loop!

And of course, once you have the resource set up correctly, you could have it live in a few seconds/minutes with a single terraform apply command!

Once live, the description file becomes a snapshot for the resource configuration params.

And just like that, your infra code becomes documentation. We can use it as a reference to set up new infrastructure on a new environment!

2. Resources' History

Of course, once something becomes code, it becomes trackable through the use of Git! Just create a repo with all of your resources and start tracking all the changes done to your infra!

Top comments (3)

Collapse
 
willianrigo profile image
Willian Rigo • Edited

Thanks for sharing info about this technology. I can tell you that this kind of infra-as-code tool is a big time saver.
I've never had used Terraform before though I've heard a lot about it.
In my backend projects I've been utilizing Serverless - serverless.com/ .
Do you think you could elaborate some thoughts on the difference between the two?
Thanks again!

Collapse
 
thiagocbarreto profile image
Thiago Barreto • Edited

I've never used Serveless before, looks nice! It seems that Serverless is more application-focused, as in all the infra is created to serve an API. Terraform allows you to create custom & connected infra, with fine-grained access control deciding what each AWS (or any other cloud provider) user has access to.

Serveless is a really nice abstraction and I'm definitely going to take a deeper look at it! Thanks for the tip!

Collapse
 
willianrigo profile image
Willian Rigo

Nice, thanks for the clarification.
I'm looking forward for more content of yours!