add uniqueness check for variables, outputs - #375
Merged
bendrucker merged 5 commits intoSep 9, 2026
Merged
Conversation
bendrucker
reviewed
Aug 20, 2026
bendrucker
left a comment
Member
There was a problem hiding this comment.
Nice, will do a code review pass later but overall looks good. Figured I'd send you these two docs nits in the meantime.
| ```hcl | ||
| rule "terraform_documented_outputs" { | ||
| enabled = true | ||
| unique = false # default |
Member
There was a problem hiding this comment.
Leave the example as the minimum required attributes
Contributor
Author
There was a problem hiding this comment.
Sorry, are you asking to remove the unique parameter from the examples?
The two documented rules were identical apart from the block type they read. Move the rule name, block type, and check onto an embedded documentedRule, leaving each rule a constructor and a Check that delegates. Issues are attributed to the concrete rule, so tflint still reports the rule the user configured. Split the description presence check from the uniqueness check. The presence pass returns the blocks that declare a description, which is the only input the uniqueness pass needs, so the boolean no longer gates half a function body.
Adds cases for descriptions that differ only in case or trailing whitespace, pinning exact comparison, and for an undocumented block declared alongside a duplicated pair, where both kinds of issue are emitted together. Drops the explicit `unique = false` case, which asserts nothing the default case does not. Always passes .tflint.hcl to the test runner, matching the other configurable rule tests.
Uses template.tf and includes the Reference line, as the surrounding examples do. States that descriptions are compared exactly, and why duplicated descriptions are worth catching.
bendrucker
approved these changes
Sep 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implemented optional description uniqueness check for outputs and variables within
terraform_documented_outputsandterraform_documented_variablesrules as discussed in #112 (comment).