Giving Terraform a Try
Giving Terraform a Try
Terraform, has been around since about 2014. Designed to be a way to do infrastructure as code. But I have never had a need to actually dive in and need it. For Azure I had ARM templates. In AWS I would use the native CloudFormation. Why try something else when I could use what comes with the cloud, I am working in. I recently had the opportunity to jump on and work with a customer. I don’t always get this opportunity so when I do it’s kind of exciting.
They needed help with some best practices around Kubernetes. Their flavor of Kubernetes is Azure Kubernetes Service or AKS for short. I got to work with their DevOps Engineer (please don’t lose your mind on the title). Great guy, but he came from a developer background, so coding was second nature for him. They were all in with infrastructure as code (IaC). But instead of rocking straight ARM templates they were doing Terraform. Me something new is exciting and being able to get my hands dirty with a customer only made this worse. I went all in. I can say I have become a fan.
First reason that turned me Providers. In Terraform its platform agnostic. Meaning I am writing the same code for any of the providers they have. So, writing ARM templates then changing context to writing CloudFormation much easier. I knew the end state I wanted I had a language to do it in I had to look up the nuances between them. This was a huge time saver for me, and stress reliever as well.
Second reason it is declarative. So, I write the state of what I want. Now I did this with different modules. I wasn’t writing one HUGE Terraform file. But I was writing a series of them provisioning the resources I needed for my application. Being that it is declarative this could let me know if there was any drift. Drift is when your setup has changed, and it has left its intended state. IaC gives us the ability to set a gold standard for our infrastructure or for me soft infrastructure. Trouble shooting became easier in an instant with terraform plan
and terraform show
. As I complain about people not understanding soft infrastructure. Their response was more of the “not my responsibility”. Their nice way of telling me they didn’t understand it.
This bridged the gap for me with infrastructure. At the end of the day it was code. Infrastructure as CODE! The code part started to demystify more and more of the infrastructure side. HashiCorp has great documentation. Each provider has detail documentation on how to provision. I knew how to click through to get what I needed with in a cloud platform. Going to documentation with HashiCorp I was discovering everything else that service has.
Sure, you can go direct and use ARM or CloudFormation. Or you can use any of the other IaC languages out there. But you will find they are OK. They do what you need them to do. But they are not going to do it as nice as you can with Terraform. Terraform is free. You can start using it right away. If you are going to use this in at work across several organizations then opt for the enterprise edition. Bottom line give it Terraform a try if you find the need needing to codify your infrastructure.
This engagement gave me the perfect opportunity to take a deep dive on Terraform. There was a lot of up-front time coding and testing what we were going to provision. But this saved us so much time on the backend when we were troubleshooting problems.