Should you include .terraform.lock.hcl in .gitignore?
One question that I had in my mind when I first build my IaC(Infrastructure as Code) with Terraform was, what all needs to be included in the .gitignore, especially the .terraform.lock.hcl.
So here is the quick answer: Yes, you should commit the .te...
blog.rishabkumar.com3 min read
Mario Cortés
DevOps, SRE, Cloud Computing
Hi, this is a interesting topic. When you run terraform in fully automated CI/CD pipeline, .terraform.lock.hcl is not added to the repository. Unless you clone the repository and init terraform locally you will be able to push the .terraform.lock.hcl file to the remote repos. So, one way to achieve compatibility would be add versions constraints on providers. Do you think that if .terraform.lock.hcl is not present it could have any issue?