Think of Terraform’s state file as its digital memory bank: it records what Terraform has built so it can compare your configuration with the real infrastructure and make only needed changes. section 9.7 section 9.7.2
Remembering what already exists
Run a configuration for one Postgres database on Monday, then run it again on Tuesday: Terraform compares your code, its state, and the cloud, and does nothing if they agree. Change allocated_storage from 50 to 100, and it updates the drive to match. section 9.7.2
That memory needs protection:
- If a local state file is lost, Terraform may forget an existing resource and create a duplicate, leaving the original unmanaged. section 9.7.3
- Teams can avoid lost updates and simultaneous-deployment collisions by storing state remotely and using locking. section 9.7.3
Figure 9.5 Terraform doesn't just "run scripts"; it reconciles reality with your text files!

See Terraform reconciling declared configuration with remembered state and real infrastructure. section 9.7.2


