Welcome to Terraform — a Resource List
As a “full-stack” developer you’ll touch everything from backend code, front-end code, and spin up infrastructure to support the code you’ve written (pushing to Heroku doesn’t count 😏). One of the things I never really took time to look into was infrastructure as code (IaC). I’ve dabbled with Chef and Puppet, but I never had a deep understanding on what I was doing or took time to learn about best practices. Honestly, I didn’t really like either of the two, but it seemed as if every project I was associated with used one of the two. So that meant I had to learn as much as necessary to work on the project.
It wasn’t until I discovered Terraform where IaC became enjoyable to me. I like how easy it is to understand the language/syntax which they call HashiCorp Configuration Language or HCL for short. At a quick glance, say looking at code to spin up something in AWS you can quickly tell what’s going on. That’s not to say that you couldn’t in any other IaC solution, but Terraform sits well with me. Check out this example:
I’ve had the chance to get a few things out into the wild with Terraform and wanted to point to some resources that answers a lot of questions that I had when I was learning about it.
The docs and guides that HashiCorp provides on Terraform are really good at explaining what’s going on. However, you may not be the type to sit down and read through docs. I get it. Luckily there is a Udemy course titled Learn DevOps: Infrastructure Automation With Terraform from a gentleman that goes by the name of Edward Viaene.
After I read through quite a bit of the docs, I snagged the course on Udemy and it helped solidify some of the things I learned from the docs. Check out the course below.
Terraform has gained a lot in popularity lately and is the tool you need to master if you are or about to get into a…www.udemy.com
Below are the docs and guides provided by HashiCorp:
Welcome to the Terraform documentation! This documentation is more of a reference guide for all available features and…www.terraform.io
Welcome to the Terraform guides! The guides provide examples for common Terraform workflows and actions for both…www.terraform.io
Now that you’ve got the basics, you’ll probably have questions like I did. What I noticed quickly was that the need to keep things organized and the need to learn the best practices from people that already use Terraform.
I wanted to know how to make code reusable and steer away from having a giant main.tf file. I also wanted to know the best way to handle things for a multistage situation (local => integration/qa => production).
Turns out there is a pretty awesome group called Gruntwork that has done all of us a huge favor in diving deep with Terraform and explaining it really well.
One of the folks over at Gruntwork has written a book titled Terraform: Up & Running. This book covers quite a bit from syntax to using Terraform in bigger teams.
This book is the fastest way to get up and running with Terraform, an open source tool that allows you to manage your…www.terraformupandrunning.com
If you’re not interested in purchasing the book, a series of posts from them basically covers the same things, linked below:
Update: we took this blog post series, expanded it, and turned it into a book called Terraform: Up & Running!blog.gruntwork.io
Gruntwork doesn’t stop there. They’ve also have sample repo’s that you can checkout that shows the breakdown on how to structure your Terraform projects. Gruntwork also created a really handy wrapper for Terraform called Terragrunt that squeezes a bit more out of Terraform aiming to keep code DRY and working with remote state within Terraform.
terragrunt - Terragrunt is a thin wrapper for Terraform that provides extra tools for working with multiple Terraform…github.com
These last two links show how you can write reusable modules and pull them into a multistage project. Gruntwork does a really good job at detailing everything and makes it really simple to follow along.
terragrunt-infrastructure-modules-example - A repo used to show examples file/folder structures you can use with…github.com
terragrunt-infrastructure-live-example - A repo used to show examples file/folder structures you can use with…github.com
With a few deploys under my belt, I can tell you that it makes a lowly “full-stack” developer like myself look like a Necromancer. It’s been enjoyable to go back and add new resources to a project or explain to another developer what’s going on with the infrastructure in a way that we can both understand.