What is the structure of the state file and what are `serial` and `lineage`?
AdvancedConceptState Internals
Answer
It is JSON with version (format), terraform_version, serial (incremented on every write), lineage (a UUID fixed when state is created), outputs and resources. Backends reject writes whose serial is older than stored state, and refuse pushing state of another lineage, which prevents overwriting one stack's state with another's.
More on State Internals
What does the state file contain?BeginnerWhat is the difference between local and remote state?BeginnerHow do you configure the S3 backend?BeginnerWhat is state locking and why does it matter?IntermediateHow does S3-native locking work and how does it replace DynamoDB?AdvancedHow do you inspect resources in state?Beginner