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.
Rule | Description | Recommended |
---|---|---|
terraform_comment_syntax | Disallow // comments in favor of # |
|
terraform_deprecated_index | Disallow legacy dot index syntax | ✔ |
terraform_deprecated_interpolation | Disallow deprecated (0.11-style) interpolation | ✔ |
terraform_deprecated_lookup | Disallow deprecated lookup() function with only 2 arguments. |
✔ |
terraform_documented_outputs | Disallow output declarations without description |
|
terraform_documented_variables | Disallow variable declarations without description |
|
terraform_empty_list_equality | Disallow comparisons with [] when checking if a collection is empty |
✔ |
terraform_map_duplicate_keys | Disallow duplicate keys in a map object | ✔ |
terraform_module_pinned_source | Disallow specifying a git or mercurial repository as a module source without pinning to a version | ✔ |
terraform_module_version | Checks that Terraform modules sourced from a registry specify a version | ✔ |
terraform_naming_convention | Enforces naming conventions for resources, data sources, etc | |
terraform_required_providers | Require that all providers have version constraints through required_providers | ✔ |
terraform_required_version | Disallow terraform declarations without require_version |
✔ |
terraform_standard_module_structure | Ensure that a module complies with the Terraform Standard Module Structure | |
terraform_typed_variables | Disallow variable declarations without type |
✔ |
terraform_unused_declarations | Disallow variables, data sources, and locals that are declared but never used | ✔ |
terraform_unused_required_providers | Check that all required_providers are used in the module |
|
terraform_workspace_remote | terraform.workspace should not be used with a "remote" backend with remote execution in Terraform v1.0.x |
✔ |