Terraform for Enterprise Cloud Infrastructure

Terraform is the usual way to describe AWS and Azure infrastructure so a second environment is a parameter change rather than a month of console work. Enterprise use of it fails in predictable ways: state on a laptop, one giant root module, and apply permissions shared in a chat.

A shape that stays reviewable

Put shared building blocks in modules. Keep the root module for one environment thin: which account, which region, which sizes. Pin provider versions. A module written for an old AWS provider is not automatically valid after an upgrade, so plan in a non-production workspace first.

Remote state with locking belongs in a backend your company controls. State contains resource IDs and often enough detail to be sensitive. It does not belong in git. It also should not be the place you store passwords. Pass those in from a secret store at apply time, or build the instance so it fetches them itself.

Plan, then apply

Nobody should apply from a workstation against production once more than one person can change the code. A pipeline, often Jenkins or the CI system you already run, posts the plan and waits for approval. Apply uses a role that can change only the intended account.

Import existing resources deliberately. Some console objects are safer left alone than half-imported and then destroyed by a typo. Write down what Terraform owns.

Images are part of the same system

An instance module that starts from an old AMI will faithfully reproduce an old AMI. Patching and Packer image builds are how the guest stays current. Terraform creates the infrastructure. It does not configure every file inside the operating system. Chef or Ansible still has that job.

Bring the repository you have if you want a module split, a remote backend, or a pipeline in front of apply.