Search⌘ K
AI Features

Provider Best Practices

Explore best practices for managing Terraform providers, including how to use the .terraform.lock.hcl file for version consistency and specify provider version constraints to ensure reliable infrastructure deployments.

When you ran terraform init, Terraform downloaded the latest versions of all of the providers that you used in your project. You may have noticed the warning message that Terraform printed out:

YAML
Terraform has created a lock file .terraform.lock.hcl to record the provider
selections it made above. Include this file in your version control repository
so that Terraform can guarantee to make the same selections by default when
you run "terraform init" in the future.

Terraform creates a special file that is used to record the version of all of the providers used. This is so that when terraform init is run again (potentially on another machine), Terraform can ...