Terraform · Infrastructure as code
What Terraform practices would you standardise across a team?
Short answer
Keep root modules small, state remote and locked, versions pinned, changes reviewed through plan output, and environments isolated. Automate fmt, validate and policy checks so humans review intent rather than syntax.
Good Terraform practice is mostly about making change safe and legible. A new engineer should be able to see where an environment lives, how state is stored, which module owns a resource, and what a plan will change before approving it.
terraform {
required_version = "~> 1.9.0"
backend "s3" {
bucket = "acme-tfstate"
key = "prod/app/terraform.tfstate"
region = "us-east-1"
encrypt = true
use_lockfile = true
}
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.60"
}
}
}A practical checklist
- One state per environment and blast-radius boundary
- Small modules with explicit inputs and outputs
- Remote state with encryption, versioning and locking
- Pinned Terraform, provider and module versions
- fmt, validate, policy and plan in CI, with approval before apply
- No secrets in code, tfvars or state where avoidable
- Documented ownership and a rollback or recovery path
Standardise the boring parts so reviewers can focus on intent. A repository template with backend configuration, CI, tagging and module conventions removes repeated decisions. Enforce the non-negotiables automatically, and leave style preferences to formatting rather than review comments.
Follow-ups you should expect
Interviewers use these to check whether the first answer was understanding or memorisation.
- 1Which practice would you adopt first in an unstructured repository?
- 2How do you enforce standards without slowing delivery?
- 3When is a monorepo the right choice?
- 4What would you put in a repository template?
Say it in the interview
I standardise the safety basics: remote locked state per environment, small modules, pinned versions, and a pipeline where fmt, validate, policy and plan run automatically and production requires approval. I also require a recovery path and clear ownership. The goal is to automate the mechanical checks so reviewers can focus on the intent and blast radius of a change. I treat the rest as defaults, not dogma.
Use this as a model, not a script. Saying it in your own words is what makes it survive follow-up pressure.
Related questions
Reading is step one
Now say it out loud.
Understanding an answer and delivering it under pressure are different skills. Rehearse this topic in a live Terraform mock interview and get scored feedback on depth, clarity and confidence.