1. What is the purpose of Terraform state files?
The Terraform state file acts as a source of truth for the deployed infrastructure. It maps resources defined in configuration files to real-world infrastructure resources. The state file enables Terraform to detect changes, plan updates, and perform drift detection accurately. It should be secured and often stored remotely in S3 or similar backends.