DevOps & cloud infrastructure agency · Clients in the US, Canada, the UK, the UAE and Australiacontact@dexecuters.comBook a 30-minute call

Terraform · Infrastructure as code · DevOps

Terraform for a five-person team: what to put in code first

You do not need every resource in Terraform on day one. The order that pays back fastest, a structure that stays small, and the mistakes that make teams give up.

The usual advice is "put everything in Terraform". For a small team with a product to ship, that is a month of work with no visible result, and it is why so many Terraform efforts end as a half-finished folder nobody trusts. The better plan is an order: the things that pay back in the first week first, the rest as you touch it.

Why bother at all

Infrastructure as code gives a small team three things it cannot get any other way: a record of what exists and why (the code and its history), the ability to rebuild an environment when something is lost or a region fails, and a review step before a change hits production. A five-person team feels the first and third immediately. The second it feels on the worst day of the year.

The order that pays back

Week 1: the network and the accounts

VPC, subnets, security groups, and the IAM roles your services use. These change rarely, they are the hardest to reconstruct from memory, and a mistake in them is the most expensive kind. Import what exists rather than recreating it; Terraform's import workflow has become straightforward.

Week 2: whatever you create more than once

Environments (dev, staging, production), a new service's load balancer and DNS, a database for a new feature. Anything you have built twice by hand is a module waiting to happen. This is where the time savings start showing up on the calendar.

Week 3: the things that must not drift

The production database (instance size, backups, multi-AZ, parameter group), storage buckets with their access rules, and the certificates. Not because you change them often, but because a silent change by hand to any of them is a future incident. In code, a change is a pull request someone reads.

Later, as you touch it

Monitoring alarms, CDN configuration, queue definitions, scheduled jobs. Add each one the next time you need to change it. Never schedule a "migrate everything" sprint; it does not survive contact with the roadmap.

Structure that stays small

  • One repository, one folder per environment, shared modules in a modules/ folder. Workspaces and clever layering are for larger teams.
  • Remote state with locking from day one (S3 with a lock table on AWS, a bucket on Google Cloud). Local state files are how two people destroy each other's work.
  • Plan in the pipeline, apply with an approval. A pull request shows the plan; a named person approves; the pipeline applies. Nobody runs apply from a laptop.
  • Short variable files, no secrets in them. Secrets live in a secrets manager and are referenced, never written down.

The three mistakes that make teams give up

  1. Writing the perfect module library before the first apply. Start with plain resources. Extract a module the second time you need the same thing, not the first.
  2. Mixing hand changes with code. The moment someone fixes production in the console and does not update the code, trust is gone and drift begins. Make the rule absolute, and make the pipeline fast enough that the rule is easy to keep.
  3. Owning the state file casually. Who can read it, where it is backed up, what happens if it is corrupted. Decide once, write it down.

What it looks like when it works

A new engineer reads the repository and understands the platform in an afternoon. A new environment is a pull request. The Series A audit-ready rebuild we did was exactly this: a console-built setup rewritten in code, which is also how it became something an auditor could follow.

We do this under build and migrate, and the import of an existing setup is usually the first thing we do in a monthly plan. If your infrastructure lives in someone's memory, the free assessment will tell you what to put in code first.

Next step

Start with the free assessment

Tell us about your setup or project. Within 48 hours you get a written reply: the biggest risks and savings we can see, and what we would do first. No account access needed to start.