IAC: Writing Infrastructure as code with “Terraform up and running” by Yevgeniy Brikman.
Well if you’re into DevOps any then you’ve probably been introduced to immutable infrastructure and building it with Hashicorps tool, Terraform. I started out using AWS’s CloudFormation but switched right after learning about Terraform. Essentially, Terraform was designed specifically for one purpose; to provision infrastructure. Yevgeniy’s book takes you from beginner to advanced in 170 pages.
Yevgeniy addresses 2 key points that anyone looking into Terraform should consider.
- What Terraform is and how it compares to other IAC tools.
- How Terraform works and the versatility it provides across multiple cloud platforms. AWS, Azure, GCP, and IBM to mention a few.
The Calm Before The Storm
In the first 30 pages, you’ll learn a few things outside of Terraform. He talks about the growth of DevOps. He gives a great breakdown of IAC and the benefits to gain from executing code that define, deploy and update your infrastructure. Basically, provisioning and managing each component of your environment with code. There are four broad categories of IAC tools:
- Ad Hoc Scripts
- Configuration Management Tools
- Server Templating Tools
- Server Provisioning Tools
Each category has a section listing tools and giving you an idea of how they’re used. It’s enough information to give you a great idea of how the categories differ from each other. This section also compares Terraform to other popular tools that you can use. Terraform is an open source provisioning tool that works with all cloud providers. It’s immutable, agentless, masterless, has a medium-size community and use a declarative language. That’s covered now let’s get dirty in Terraform.
Yevgeniy uses Amazon’s platform for teaching us the basics. Makes sense, they own the majority of the cloud market. GCP and Azure are gaining ground though but it’s still a pretty substantial gap. He walks you through setting up an AWS account and installing Terraform. You’ll be deploying your first t2.micro instance within the next few pages. No need to worry, the t2 instance is free tier so take advantage while you can. Before you know it you will deploy a cluster of web servers. You’ll touch autoscaling launch configs, security groups, load balancers and etc. I’m a huge fan of the effort Yevgeniy put into writing this for us. After the basics, you get a plethora of information that will take you to the next level. You learn what terraform state is and how to manage it. This is very helpful for projects that require multiple people to have access. You’ll see the benefits of creating reusable infrastructure with Terraform modules. Modules save you a lot of time while helping you follow the ideology of keeping things DRY(DO NOT REPEAT YOURSELF). Chapter 5, it’s definitely my favorite. You get tips while learning how to use loops, conditionals, and interpolation functions. There is also a section labeled Terraform Gotchas. Yevgeniy points out a few problems you could easily get hung up on. The final chapter wraps up how to use Terraform as a team. Which in a DevOps environment, teamwork & communication are essential to the success of the project. So the final chapter focuses on version control, automated testing, coding guidelines, and workflow.
Now this book isn’t meant to be a replacement for documentation, but it’s a great start to learning terraform and how to optimize your infrastructure. You aren’t going to find a better resource that will give you a better start to using Terraform. Buy the book, read the book and start building. If the goal is to minimize the amount of time it takes to deliver a product to the customer, then I’m sure you’re interested in IAC. Why not use one of the best tools on the market for it.
terraform apply buyBook.tf
PS: You may find this useful one day. Terraform.