📝 From Terraform Confusion to Clarity

What Building a Real ECS Fargate Project Taught Me

1️⃣ The Confusion That Started It All

At the beginning, Terraform felt familiar.

I had already used Terraform to create a VPC, EC2 instances, ECS resources, and everything worked. During one class, the tutor said the next step would be creating Terraform modules.

That confused me.

I had multiple .tf files. Terraform was working.

So I thought, are these not already modules?

That question stayed with me until I tried to build a real project on my own.

2️⃣ What I Was Actually Doing

What I later understood is that I was working inside a single root module.

  • Multiple .tf files
  • Resources grouped by purpose
  • A setup that worked for learning

Terraform treats all .tf files in the same folder as one unit. That is why everything worked.

But this approach does not scale well.

  • There was no clean separation
  • Everything depended on everything
  • Reusing parts was difficult
  • Managing environments would have been risky

It worked, but it was fragile.

3️⃣ The Aha Moment 💡

The big realization came when I understood the difference between a root module and child modules.

  • The root module is where Terraform runs
  • Child modules are reusable building blocks
  • Modules accept inputs
  • Modules expose outputs
  • Modules define responsibility boundaries

Once I separated networking, load balancing, and compute into modules, things started to click.

I also understood why environment separation matters. Development and production should not share the same execution context or state.

This was no longer about syntax. It was about design.

4️⃣ Why This Matters in Real Projects

  • Multiple people work on the same code
  • CI pipelines run Terraform automatically
  • Multiple environments exist at the same time

Without modules and clear boundaries, things break quietly and expensively.

Recruiters are not only looking for tools. They are looking for structure and thinking.

5️⃣ What I Changed in My Project

  • Clear Terraform modules
  • A dedicated environment folder
  • Clean inputs and outputs
  • A predictable execution flow

The code became easier to understand. Scaling became realistic. The story behind the project became stronger.

🎯 Final Reflection

This project taught me that DevOps is not about perfection. It is about clarity, safety, and intentional decisions.

Understanding why things break is more valuable than things simply working.

And now, I finally understand what Terraform modules are really for.