← All logsLogs · Infra

Why I keep Terraform state in S3

Jun 2026 · Infra

Terraform state on a laptop is easy to lose or overwrite. Keeping it in S3 leaves one shared copy that can be reviewed before an apply.

The problem with local state

Terraform records what it built in a state file. If that file only exists on one machine, it can be lost, changed by mistake, or simply left behind when someone else needs to run an apply.

What I do instead

I store the state in S3 so there is one shared copy of it. Before applying changes I read the plan and check what Terraform intends to change, rather than assuming the previous run left everything as expected.

The habit

It is a small setup step, not a complicated system. It mainly makes the next change less surprising for whoever runs it.

← Back to all logs