Intro to Terraform and Infrastructure-as-Code

Building a house is big work. Could you build a house on your own, given the tools and materials? With enough Googling and DIY Youtube videos, I’m sure you could. But how long would that take? Years? I know I wouldn’t have it finished anytime soon.

Now let’s say that instead of building the house from scratch on your own, you can simply describe what you want via blueprint and a construction crew will do the heavy lifting. (You know, the way most people actually design their own homes?) This is much simpler and will result in a livable home much more quickly. And what if a meteor demolishes your home later, or you want to build another home? Rather than rebuild it from memory – assuredly screwing up details in the process – you can simply present the blueprint once again and expect the exact same result.

So it is with Terraform, an open-source tool from Hashicorp which allows us to use a declarative language to design and deploy cloud infrastructure on an Infrastructure-as-Code (IaC) basis. Terraform is supported by all the major cloud infrastructure providers (AWS, Azure, GCP, etc) and can even be leveraged to create cross-platform environments.

What is IaC? Hashicorp defines it this way:

“[Infrastructure-as-Code] is the process of managing infrastructure in a file or files rather than manually configuring resources in a user interface. A resource in this instance is any piece of infrastructure in a given environment, such as a virtual machine, security group, network interface, etc.”

UIs for the major cloud providers tend to be very intuitive and easy-to-use, but replicating similar infrastructure over and over through relentless button-clicking takes a lot of time and effort. What if you’re standing up an enterprise application environment requiring hundreds of components? We’re talking hours of painstaking, error-prone work. IaC addresses this problem by allowing us to simply design a blueprint and iterate it repeatedly to create segments of similar infrastructure.

In addition, IaC allows us to leverage change and version control that can’t be achieved through a point-and-click UI. When changes need to be made, the infrastructure code can be first reviewed in way that allows approving authorities to see exactly what will be modified with perfect accuracy – and using a version control system like Github allows code to be rolled back in case of issues.

Terraform, as an IaC solution, boasts all of the preceding benefits in addition to being incredibly easy to understand and simple to learn. As an engineer with a specifically IT-focused and non-development background, I thought back on my college C++ course with apprehension – expecting Terraform to be equally as obtuse and difficult when I decided to start teaching it to myself. Thankfully, the learning curve on Terraform is shockingly easy – dedicate a few hours to learning the basics and you’ll be standing up your own infrastructure via Terraform within the week!

Want to get started? This is the video I watched to get the ball rolling – I strongly recommend it:



Categories: Cloud, Free Tools, Products

Tags: , , ,

%d bloggers like this: