Skill 2.4.1
Why Terraform needs state
Key Concepts
When Terraform creates an object, the platform returns an identifier, such as an instance ID. Terraform records it in state, bound to the resource address in the configuration, such as aws_instance.web. On the next run, Terraform knows that this address already has an object and which one, so it can update it rather than create another. Without state, Terraform could not tell which real objects it manages, because many platforms have no reliable way to tag every object.
State also stores metadata, such as dependencies that are needed to destroy resources in the right order after they have been removed from the configuration, and it acts as a cache of attribute values. For large configurations, -refresh=false lets Terraform plan from the cached values without querying every object.