DevOps and You: Terraform


This is a follow-up to my earlier post on DevOps. If you aren’t familiar with the topic, have a read first.

Don’t worry, I’ll wait. (Where’s my coffee?)

Now that you’re back, let’s talk about Terraform. In my earlier post I mentioned Troposphere and Terraform as frameworks that help to make DevOps easier. Of course, one can always use the AWS CLI (command line interface), but why? I kid, I kid; the CLI is very useful and we use it all the time. It is very straightforward if you're an ops person who is a bash-God. IMHO, Troposphere is a bit difficult to work with and requires a decent amount of coding via Python. Since I’m not a Python developer, there was quite a ramp up to get started with Troposphere. It’s still usable and gets the job done but there’s a decent bit of coding required.

Terraform was a bit easier to digest, as it is a configuration based tool which uses a JSON-like structure. Terraform is a tool for building, changing, and versioning infrastructure safely and efficiently. You can use terraform to build the infrastructure for a simple component or your entire application infrastructure. This structure makes Terraform super easy to understand for WebServices developers. Ahhh, I love it when standardization bubbles its way to the top.

Terraform allows users the ability to quickly create templates for AWS components in HCL (HashiCorp Configuration Language) or JSON and then create/update/destroy those components. The HCL and JSON formats can be equated to a short ramp up for most developers. As the configuration changes, Terraform is able to determine what changed and create incremental execution plans which can be applied. When using Terraform to provision infrastructure, it records the state of your infrastructure in state files. In order to make changes to your infrastructure, everyone on your team needs access to these state files. Everyone knows when multiple people alter a file all at the same time, that can lead to chaos. In this case, you need a locking mechanism. One could pay for this ability, or you can use Terragrunt. In our case, we used Terragrunt.

As a bit of a skeptic, I don’t get too excited about new technology right off the bat. However, I’m super excited about Terraform. It’s well documented, straightforward, allows for a high degree of flexibility, and modularity. Further, if you are an IntelliJ user, there’s a Hashicorp HCL plugin that makes working like a cool breeze! Wait, isn’t cool breeze a rapper? Good grief.

Hopefully, this has been mildly educational and helpful enough to get more people to take the step into DevOps. For more information on DevOps or anything else, contact TechSparq.

Dedrick BoydTechSparq