What exactly is Terraform State?

Terraform keeps records of the resources it creates in a state file. Terraform may then determine which resources are under its control and when to update and delete them. The terraform state file is named terraform.tfstate by default and is stored in the same directory as Terraform is launched. It is formed following the execution of terraform apply. The actual content of this file is a JSON-formatted mapping between the configuration’s resources and those that exist in your infrastructure. When Terraform is executed, it may utilize this mapping to compare infrastructure to code and make any required improvements.