TE

Terraform Defaults

Core Terraform/HCL coding conventions for readable, maintainable infrastructure code

Details

Language / Topic
terraformTerraform
Category
Style Guide

Rules

balanced
- Use `snake_case` for all resource names, variable names, and output names — never use hyphens or camelCase in HCL identifiers.
- Always pin provider versions with `required_providers` using `~>` for minor version constraints: `version = "~> 5.0"`.
- Organize each module with `main.tf`, `variables.tf`, `outputs.tf`, and `versions.tf` — never place everything in a single file.
- Wrap complex expressions in `locals {}` blocks and reference them by name — avoid repeating inline expressions across multiple resources.