Use this when tools keep state between runs, like Terraform state.
State Store
A state store keeps the recorded state of managed resources between runs, such as Terraform state, so the tool can calculate what to change. Store it remotely with locking and protect its secrets.
1. State stores record what automation manages (Terraform state, workflow state, inventory caches).
2. Remote, locked, encrypted, versioned.
3. Never edit by hand casually.
4. Contains secrets — restrict access.
5. Back up.
automation → state store → next run compares
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Common mistakes Narrow the fault
- Local state files on one laptop.
- State with secrets stored unencrypted.
- Manually editing state instead of
terraform state mv/rm.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
- The state store records what the tool manages between runs.
- State can contain secrets such as passwords.
- Concurrent writers corrupt state without locking.
terraform state list— Terraform state contents- Backend (S3/azurerm/consul) with locking — remote state
- State backups/versioning — recovery
ReferenceWhy it matters1 section · depth on demand
What it is
The state store keeps what the automation knows about managed resources between runs: Terraform state, a database of job results, or Kubernetes etcd. Plans are computed against it, so it must be shared, locked during runs and backed up.
ReferenceHow it works1 section · depth on demand
In depth
A state store holds what an automation system knows about the resources it manages — Terraform state, workflow progress, last-applied configuration, inventory caches. Many tools depend on it to calculate changes, so a lost, corrupted or out-of-date state store causes wrong plans or duplicate resources.
| Requirement | Why |
|---|---|
| Shared and remote | All runners see the same state |
| Locking | Two runs cannot write at once |
| Versioning/backups | Recover from corruption or bad runs |
| Encryption and access control | State often contains sensitive data |
| Single writer per scope | Avoid conflicting updates |
Never edit a state store by hand except through the tool's own commands (terraform state mv/rm, import), and back it up first.
ReferenceImportant terms & boundaries1 section · depth on demand
Example
terraform state list
terraform state show aws_instance.web
terraform force-unlock <lock-id> # only after confirming no run is active
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Automation Architecture > State Store. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://learn.microsoft.com/en-us/azure/well-architected/operational-excellence/enable-automation · confidence 94%