Difference Between Terraform Statefile Vs Terraform Lockfile
Terraform Statefile |
Terraform Lockfile |
---|---|
Terraform statefile maintains the current state of the cloud infrastructure which is provisioned using the terraform. |
The Terraform lock file is mainly used to lock the versions of the provides and the Terraform if someone is using it on another machine they will not get the version conflicts. |
The Terraform state file is formatted in the JSON format which contains all the details related to the resources configured in the cloud. |
The Terraform state file is formatted in the JSON format which contains all the details related to the resources configured in the cloud. Records the versions of the providers and terraform which are used to configure the cloud infrastructure. |
Terraform statefile format was as follows (.terraform.tfstate)”. |
Terraform lockfile format was as follows “(.terraform.lock.hcl)”. |
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.