Take a flat Terraform project and refactor it into reusable modules for cleaner structure and easier maintenance.
Understand why Terraform modules matter and how to separate reusable infrastructure components.
Inspect the existing project and identify where responsibilities are mixed together.
Review all resources in root files
Group related resources logically
Plan module boundaries
Extract reusable blocks into dedicated module directories.
Create module folders
Move resources into modules
Define input variables
Define outputs
Call modules from the root configuration and verify behavior.
Use module blocks in root project
Pass required variables
Run fmt, validate, and plan
Review a flat Terraform project.
Define logical module boundaries.
Move resources into modules.
Pass variables and outputs.
Validate the refactored structure.
terraform validate succeeds after refactor
terraform plan still shows expected behavior
Modules are reusable and readable
README explains the module structure
Refactored Terraform project
At least one reusable module
README with module explanation
Strong project for explaining how you keep Terraform maintainable as infrastructure grows.
Overcomplicating modules too early
Not defining clear inputs and outputs
Breaking references during refactor
Keeping too much logic in root files
Publish a reusable internal module
Add module versioning
Split modules by environment
Use modules in a larger AWS project