A TFLint ruleset that enforces formatting and style conventions for Terraform code.
- TFLint v0.46+
- Go v1.26
You can install the plugin with tflint --init. Declare a config in .tflint.hcl as follows:
plugin "prettier" {
enabled = true
version = "0.2.0"
source = "github.com/joshuaspence/tflint-ruleset-prettier"
}| Name | Description | Severity | Enabled By Default | Link |
|---|---|---|---|---|
| aws_hardcoded_ids | Validates that there are no hardcoded AWS account IDs or AMI IDs | WARNING | ✅ | docs |
| aws_iam_policy_hardcoded_partition | Validates that there are no hardcoded AWS partitions in IAM policy documents | WARNING | ✅ | docs |
| aws_iam_policy_hardcoded_region | Validates that there are no hardcoded AWS regions in IAM policy documents | WARNING | ✅ | docs |
| aws_iam_role_policy_hardcoded_partition | Validates that there are no hardcoded AWS partitions in IAM role policy documents | WARNING | ✅ | docs |
| aws_iam_role_policy_hardcoded_region | Validates that there are no hardcoded AWS regions in IAM role policy documents | WARNING | ✅ | docs |
| aws_meta_hardcoded | Validates that there are no hardcoded AWS regions or partitions in ARN values across all resource types | WARNING | ✅ | docs |
| aws_provider_hardcoded_region | Validates that there are no hardcoded AWS regions in provider configuration | WARNING | ✅ | docs |
| aws_service_principal_dns_suffix | Validates that service principals don't use dns_suffix interpolation | WARNING | ✅ | docs |
| aws_service_principal_hardcoded | Validates that service principals don't use hardcoded DNS suffixes (e.g., amazonaws.com) | WARNING | ✅ | docs |
| aws_policy_no_jsonencode | Flags use of jsonencode() in policy attributes on AWS resources |
NOTICE | ✅ | docs |
| output_must_be_in_outputs_file | Ensures all output blocks are declared in outputs.tf |
NOTICE | ✅ | docs |
| typed_variables | Ensures all variables have an explicit type constraint |
WARNING | ✅ | docs |
| variable_must_be_in_variables_file | Ensures all variable blocks are declared in variables.tf |
NOTICE | ✅ | docs |
| indented_heredoc | Suggests indented heredoc syntax (<<-) instead of standard heredoc (<<) |
NOTICE | ✅ | docs |
| list_trailing_comma | Validates that the last item in a multi-line list ends with a trailing comma | NOTICE | ✅ | docs |
| map_trailing_comma | Validates that maps have consistent trailing commas | NOTICE | ✅ | docs |
| variables_order | Validates that variable blocks are sorted alphabetically | NOTICE | ✅ | docs |
Clone the repository locally and run the following command:
$ make
You can easily install the built plugin with the following:
$ make install
You can run the built plugin like the following:
$ cat << EOS > .tflint.hcl
plugin "prettier" {
enabled = true
}
EOS
$ tflint