What is Terraform Statefile?
Terraform is the main component of the terraform it maintains the current state of infrastructure which is built using terraform. The language used in the terraform state file was JSON-formatted. The Terraform state file maintains the following details
- Resource IDs
- Metadata and
- dependencies.
When we write a new terraform config file and apply it then terraform will generate this file. If there is any previous state file it will update that state file to the current state by updating it. The Terraform state file maintains the updated state of the infrastructure in the cloud.
When you execute the terraform application then the state file will be created by the AWS automatically to maintain the state of the Cloud infrastructure.
What Is Terraform Lock FIle?
The terraform lock file is named “Terraform. lock.hcl” It will generated by the terraform itself and it will make sure that the same infrastructure will be created if multiple users are working. It serves as a central repository for the particular provider and module versions that you have used in your configuration.