Handling of versions.tf is simple in a simple single directory/module project, but as a project becomes complex, starts using in-house as well as third-party modules, then versions.tf raise numerous questions on where those are needed, where recommended, etc.
The key thing to note here is that the version constraints are a per-module idea and so should ideally be included in every directory that contains .tf files, describing which Terraform and provider versions each specific module is compatible with. There is no expectation that all of your modules would declare the same requirements, because each one will be using different features of Terraform and different provider features.
I think this deserves a place in any collection of Terraform best practices.
Handling of
versions.tf
is simple in a simple single directory/module project, but as a project becomes complex, starts using in-house as well as third-party modules, thenversions.tf
raise numerous questions on where those are needed, where recommended, etc.@apparentlymart offered an excellent explanation in the How to set up versions.tf at root level of directory thread:
I think this deserves a place in any collection of Terraform best practices.