Best Practices
Terraform does not require particular filenames inside a module. The following layout is a recommended convention that keeps a root module easy to navigate:
versions.tf: Terraform and provider requirementsbackend.tf: backend configuration, when the module uses a separate backend fileproviders.tf: provider configurationmain.tf: primary resources and data sourcesvariables.tf: input variablesoutputs.tf: outputs exposed by the moduleREADME.md: purpose, usage, inputs, outputs, and examples
The repository convention is providers.tf. Use this filename for every provider configuration, including root modules and Snowflake hands-on solutions.
Additional conventions:
- Use
snake_casefor Terraform resource names. - Define variables with a type and a useful description.
- Define outputs with a value and a useful description.
- Use explicit Terraform and provider version constraints and review them regularly. Shared modules usually prefer compatible ranges such as
>=or~>, while root modules can be pinned more tightly when needed.