Terraform and the Art of Small: My Guide to Navigating Smarter, Safer State Management

Orellanaluke
5 min readFeb 4, 2024

Over my years in DevOps, Infrastructure, and Platform teams, I’ve encountered numerous challenges with Terraform. While many tutorials and examples excellently demonstrate the initial setup and deployment using Terraform, there’s a significant gap in content for handling the subsequent phases — Day 2, Day 3, and beyond. One critical aspect often overlooked is Terraform State management. It’s a concept that seems straightforward at first but can seriously hinder or delay a project if not handled properly.

Based on my experience with both large and small Terraform infrastructure projects, I’ve found one simple trick that changes the game for collaborating with teams, safer deployments, and making Terraform projects easy to change— keeping state small.

The Magic of Small: Quick Changes

Bob Martin, renowned for his book “Clean Code,” emphasizes the importance of keeping functions small and focused in software engineering. This approach facilitates faster and safer code modifications. I’ve observed a parallel in managing Terraform state: smaller states reduce the likelihood of being hindered by bugs or drift.

In Terraform, drift occurs when the state file doesn’t accurately reflect the actual…

--

--