Chapter 8 - Terraform Dependency lock file
Learn what the Terraform Dependency lock file is.
Terraform Dependency lock file
Only tracks provider dependencies. Check this into your code repo so that other runs across your team are consistent.
Upgrading your provider across major versions, this may introduce breaking changes to your code. The lock file prevents the upgrade without taking the extra step to actually upgrade the provider.
Random string provider
https://registry.terraform.io/providers/hashicorp/random/latest/docs
Documentation
You will need to switch to the matching documentation in the terraform registry when selecting previous versions. The documentation defaults to the latest and may or may not be valid for your provider version.
Short dependency lab
- Build out a storage account and a RG using 1.44.0 of the provider
- update to a newer provider version
- run
terraform init -update
to update to the newer provider
- Check the version in the lock.hcl file.
- Run the
terraform plan
and then you'll notice that there are unsupported arguments and changes to blocks in the code that previously worked.
- You can then refer to the documentation for the newer provider to update the terraform code per that new documentation
The updating of the code should get you into a no changes state.