Rules

October 17, 2025 · View on GitHub

Terraform Language rules implement recommendations from the Terraform Language documentation. This ruleset does not provide configurable rules for personal/team style or usage preferences. If you'd like to enforce stylistic rules beyond the official Terraform Language recommendations, you should author your own ruleset plugin.

All rules are enabled by default, but by setting preset = "recommended", you can enable only the rules marked "Recommended" among the following rules. See Configuration for details.

RuleDescriptionRecommended
terraform_comment_syntaxDisallow // comments in favor of #
terraform_deprecated_indexDisallow legacy dot index syntax
terraform_deprecated_interpolationDisallow deprecated (0.11-style) interpolation
terraform_deprecated_lookupDisallow deprecated lookup() function with only 2 arguments.
terraform_documented_outputsDisallow output declarations without description
terraform_documented_variablesDisallow variable declarations without description
terraform_empty_list_equalityDisallow comparisons with [] when checking if a collection is empty
terraform_json_syntaxEnforce the official Terraform JSON syntax that uses a root object
terraform_map_duplicate_keysDisallow duplicate keys in a map object
terraform_module_pinned_sourceDisallow specifying a git or mercurial repository as a module source without pinning to a version
terraform_module_shallow_cloneRequire pinned Git-hosted Terraform modules to use shallow cloning
terraform_module_versionChecks that Terraform modules sourced from a registry specify a version
terraform_naming_conventionEnforces naming conventions for resources, data sources, etc
terraform_required_providersRequire that all providers have version constraints through required_providers
terraform_required_versionDisallow terraform declarations without require_version
terraform_standard_module_structureEnsure that a module complies with the Terraform Standard Module Structure
terraform_typed_variablesDisallow variable declarations without type
terraform_unused_declarationsDisallow variables, data sources, and locals that are declared but never used
terraform_unused_required_providersCheck that all required_providers are used in the module
terraform_workspace_remoteterraform.workspace should not be used with a "remote" backend with remote execution in Terraform v1.0.x