Domain-Driven Infrastructure: Why Terraform Should Be Organized by Business Logic
A software engineer argues that most Terraform repositories are structured by technology type — grouping VPCs, IAM, Lambda, and RDS in separate directories — rather than by business domain or reason to change. This technology-first approach causes a single business requirement, such as shipping a feature or updating compliance rules, to scatter changes across multiple unrelated directories. Drawing on the Single Responsibility Principle from software design, the author proposes 'Domain-Driven Infrastructure,' which organizes cloud infrastructure code around shared business ownership, regulatory scope, and risk boundaries. The concept borrows from Domain-Driven Design's strategic patterns, specifically bounded contexts, and applies them to Terraform state and directory structure. The goal is to improve cohesion so that changes driven by the same business need are co-located, making infrastructure diffs safer and easier to review.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in