Member-only story

Should .terraform.lock.hcl be included in the .gitignore file?

Sarah Lean
3 min readFeb 27, 2024

--

Explore what the .terraform.lock.hcl file is and if you should include it in your version control environment.

Welcome to this blog post where we delve into the intricacies of and discuss a crucial aspect of managing Terraform projects: the .terraform.lock.hcl file.

In this article, we’ll explore what exactly the .terraform.lock.hcl file is, its significance in Terraform projects, and the debate surrounding whether or not you should commit it to your version control repository.

Join us as we unravel the importance of this file and its impact on your Infrastructure as Code(IaC) workflow.

What is the .terraform.lock.hcl file?

According to the official Terraform documentation the .terraform.lock.hcl file is:

So let’s dive into that a bit more and explain it. When you’re using Terraform and you run terraform init, it’s basically setting up everything you need for your project, like installing different pieces that help make your project work.

Now, here’s where it gets interesting: Terraform wants to make sure it’s using the right versions of those pieces, so it checks two things.

--

--

Sarah Lean
Sarah Lean

Written by Sarah Lean

Community Speaker — Lifelong Learner — Founder of the Glasgow Azure User Group

No responses yet