Rules
core
| Rule | Description | Severity | Category | Recommended | Fixable |
|---|---|---|---|---|---|
documented-outputs | Require every output block to have a description. | error | core | ✔ | |
documented-variables | Require every variable block to have a description. | error | core | ✔ | |
module-source-pinned | Require module sources to be pinned via ?ref=, a version attribute, or a local path. | error | core | ✔ | |
no-bool-as-count | Flag a count meta-argument set to a boolean; Terraform 0.12 removed bool-to-number coercion. | error | core | ✔ | ✔ |
no-duplicate-map-keys | Flag a repeated statically-known key in an object literal. HCL keeps only the last entry and silently discards the earlier ones. | error | core | ✔ | |
no-empty-list-equality | Flag == or != against an empty tuple literal [], which never matches a list, set, or map value. Use length(expr) == 0 instead. | error | core | ✔ | ✔ |
no-external-refs-in-destroy-provisioner | Flag references to anything other than self, count.index, or each.key/each.value inside provisioner blocks with when = destroy. | error | core | ✔ | |
no-legacy-count-attribute | Flag references to the legacy .count attribute of a resource, removed in Terraform 0.12. Use length(...) instead. | error | core | ✔ | ✔ |
no-legacy-dot-index | Flag legacy dot forms list.0 and a.*.b. Use bracket index list[0] and full splat a[*].b. | warn | core | ✔ | ✔ |
no-legacy-ignore-changes-wildcard | Flag the quoted ["*"] wildcard in a lifecycle ignore_changes list, replaced by the unquoted all keyword in Terraform 0.15. | error | core | ✔ | ✔ |
no-legacy-list-function | Flag the legacy list(...) function, removed in Terraform 0.15. Use a [...] tuple literal instead. | error | core | ✔ | ✔ |
no-legacy-lookup | Flag two-argument lookup(), deprecated since Terraform 0.7. Use index syntax instead. | warn | core | ✔ | ✔ |
no-legacy-map-function | Flag the legacy map(...) function, removed in Terraform 0.15, in favor of a { key = value } object literal. | error | core | ✔ | ✔ |
no-legacy-provider-proxy | Flag empty provider blocks that exist only to declare an alias; replace with configuration_aliases in required_providers. | error | core | ✔ | |
no-provider-version-constraint | Flag a version argument inside a provider block; declare the version in terraform.required_providers instead. | warn | core | ✔ | |
no-quoted-depends-on | Disallow quoted references in depends_on; use bare references. | warn | core | ✔ | ✔ |
no-quoted-ignore-changes | Disallow quoted references in a lifecycle ignore_changes list; use bare attribute references. | warn | core | ✔ | ✔ |
no-quoted-provider-reference | Disallow quoted provider references in provider arguments and module providers maps; use a bare traversal. | warn | core | ✔ | ✔ |
no-quoted-type-constraints | Disallow quoted type constraints in variable blocks; use the unquoted type keyword. | error | core | ✔ | ✔ |
no-reserved-variable-names | Disallow variable blocks named after an OpenTofu reserved meta-argument. | error | core | ✔ | |
no-splat-bracket-index | Flag a constant index applied to a splat result, a pre-0.12 artifact; index the resource first instead. | warn | core | ✔ | |
no-template-provider | Flag use of the archived hashicorp/template provider; prefer the built-in templatefile() function or the cloudinit provider. | error | core | ✔ | |
no-terraform-env-reference | Flag references to terraform.env, replaced by terraform.workspace since Terraform 0.10. | error | core | ✔ | ✔ |
no-winrm-connection | Flag connection blocks with type = "winrm"; winrm is deprecated in OpenTofu 1.12 and slated for removal in 1.13. Use type = "ssh". | warn | core | ✔ | |
prefer-bare-expression | Prefer the bare expression form over the redundant "${expr}" wrapping. | warn | core | ✔ | |
provider-source-required | Require every provider in terraform.required_providers to declare an explicit source. | error | core | ✔ | |
remote-state-outputs-prefix | Flag a data.terraform_remote_state reference that omits the required .outputs. prefix, required since Terraform 0.12. | error | core | ✔ | ✔ |
required-providers-pinned | Require every provider in terraform.required_providers to declare a version constraint. | error | core | ✔ | |
required-version-declared | Require a terraform block that declares required_providers to also declare required_version somewhere in the same file. | warn | core | ✔ | |
typed-variables | Require every variable block to declare a type. | error | core | ✔ |
aws
| Rule | Description | Severity | Category | Recommended | Fixable |
|---|---|---|---|---|---|
acm-certificate-create-before-destroy-required | Require lifecycle { create_before_destroy = true } on aws_acm_certificate so replacing an in-use certificate does not hang until timeout. | warn | aws | ✔ | |
no-api-gateway-deployment-stage-args | Flag stage_name, stage_description, and canary_settings on aws_api_gateway_deployment, removed in AWS provider v6; manage the stage with a separate aws_api_gateway_stage resource. | error | aws | ✔ | |
no-aurora-pinned-minor-with-auto-upgrade | Flag an Aurora PostgreSQL cluster that pins engine_version deeper than the auto minor upgrade enabled across its instances will hold stable, which drifts on every plan. | warn | aws | ✔ | |
no-db-instance-name-attribute | Flag the top-level name argument on aws_db_instance, removed in AWS provider v5. Use db_name with the same value. | error | aws | ✔ | ✔ |
no-deprecated-lambda-runtime | Flag AWS-deprecated Lambda runtime identifiers on aws_lambda_function and aws_lambda_layer_version and name the nearest supported successor. | warn | aws | ✔ | |
no-eip-vpc-attribute | Flag the vpc argument on aws_eip, removed in AWS provider v6. Use domain = "vpc" (or omit domain). | error | aws | ✔ | ✔ |
no-eks-addon-resolve-conflicts | Flag the resolve_conflicts argument on aws_eks_addon, removed in AWS provider v6. Use resolve_conflicts_on_create and resolve_conflicts_on_update. | error | aws | ✔ | |
no-hardcoded-provider-credentials | Flag literal access_key, secret_key, or token values in provider "aws" and s3 backend blocks, which leak credentials into source control. | error | aws | ✔ | |
no-iam-policy-attachment | Flag aws_iam_policy_attachment, which manages a managed policy's attachments exclusively account-wide; prefer the non-exclusive per-principal attachment resources or the *_policy_attachments_exclusive resources. | warn | aws | ✔ | |
no-iam-role-inline-policies | Flag deprecated inline inline_policy blocks and the managed_policy_arns argument on aws_iam_role; prefer standalone aws_iam_role_policy / aws_iam_role_policy_attachment resources. | warn | aws | ✔ | |
no-instance-cpu-count-attributes | Flag cpu_core_count and cpu_threads_per_core on aws_instance, removed in AWS provider v6; move the values into a cpu_options block. | error | aws | ✔ | ✔ |
no-legacy-security-group-rules | Flag legacy aws_security_group_rule resources and inline ingress/egress blocks; prefer aws_vpc_security_group_ingress_rule and aws_vpc_security_group_egress_rule. | error | aws | ✔ | |
no-mixed-security-group-rule-forms | Warn when a standalone security group rule targets an aws_security_group that also defines inline ingress/egress blocks, which causes drift. | warn | aws | ✔ | |
no-pinned-minor-with-auto-upgrade | Flag AWS engine resources that pin engine_version deeper than an enabled auto_minor_version_upgrade will hold stable, which drifts on every plan. | warn | aws | ✔ | |
no-s3-bucket-inline-config | Flag deprecated inline configuration on aws_s3_bucket; use the dedicated standalone aws_s3_bucket_* resources instead. | warn | aws | ✔ | |
no-s3-bucket-object | Flag the deprecated aws_s3_bucket_object resource and data source and the aws_s3_bucket_objects data source; use aws_s3_object and aws_s3_objects instead. | warn | aws | ✔ |
cloudflare
| Rule | Description | Severity | Category | Recommended | Fixable |
|---|---|---|---|---|---|
access-rule-country-block-requires-enterprise | Flag a cloudflare_access_rule that blocks by country while settings.lintofu.cloudflare.plan is below Enterprise, the only plan Cloudflare allows it on. | error | cloudflare | ✔ | |
dns-record-requires-managed-by-annotation | Require a cloudflare_dns_record to carry the configured comment, plus the configured tag when settings.lintofu.cloudflare.plan is Pro or higher, so the record shows it is managed by Terraform. | warn | cloudflare | ✔ | |
ruleset-requires-managed-by-description | Require a cloudflare_ruleset to set its top-level description to the configured marker, so the ruleset shows it is managed by Terraform. | warn | cloudflare | ✔ |