What is the name of the dependency lock file created by Terraform when it locks its state?

Master the HashiCorp Terraform Test with these flashcards and multiple choice questions. Each question includes hints and explanations to prepare you effectively. Set yourself up for success!

The correct answer is the file named ".terraform.lock.json". This lock file is essential in Terraform as it ensures that the module versions used in the configuration remain consistent across different runs and environments. By locking the versions of providers and modules, Terraform maintains a stable and predictable infrastructure, reducing the chances of unexpected changes due to updates in the module dependencies.

The ".terraform.lock.json" file is automatically generated by Terraform when it initializes a configuration or when dependencies are installed. It captures the exact version of each provider being used, allowing Terraform to retrieve the same versions later on. This ensures that your infrastructure remains the same, even if the upstream dependencies change.

The other options, such as ".terraform.lock" and ".terraform.lock.hcl," do not represent actual files created by Terraform. The ".terraform.state" file, while important as it holds the latest state of the managed infrastructure, is distinct from the lock file which specifically addresses versioning and dependency management.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy