Menu

1 / 5

Terraform Project Structure: 3 Layouts That Scale

DEV Community: terraform·Michael Zion·12 days ago
#h5ZvFoNZ
#devtoterraform#devto#dev#terraform#state
Reading 0:00
15s threshold

This guide was written by Michael Zion , CEO at MeteorOps, and first published on the MeteorOps blog .

Bottom line

A good Terraform project structure keeps reusable modules separate from the root modules that deploy them, gives every environment and major component its own state file, and pins provider and module versions. Start with one directory per environment, split state by blast radius as you grow, and add Terragrunt only when duplication actually hurts.

Most guides stop at "put variables in variables.tf". That is the easy part. The decisions that matter are how you split state, how environments differ without copy-paste drift, how changes are reviewed and applied, and when to change the layout as the team grows. This guide covers all of them with three reference layouts you can copy, sized for teams of roughly 1 to 5, 5 to 20, and 20 to 50 engineers.

Terraform project structure basics: files and modules

Inside any single Terraform directory, follow HashiCorp's Terraform style guide file names.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.