tflint
tflint copied to clipboard
feat: support custom messages when failing tflint checks
Would be nice to be able to define custom messages in every rule to either overwrite or append tflint's default message
Since messages are assembled in code, just allowing a static replacement seems a bit confusing. Can you provide a real world example of how you'd use this?
rule "aws_resource_missing_tags" {
enabled = true
tags = ["Foo", "Bar"]
exclude = ["aws_autoscaling_group"] # (Optional) Exclude some resource types from tag checks
msg = "bro bro bro you're missing some really important tags. see this confluence page for our mandatory tags page and why each tag is useful. also see this link for our custom terraform module that implements this to make life easier."
}
Hmm, how about a custom URL that replaces the self-link to the TFLint docs? That way if you have custom rule configuration you can link to a custom document that describes how to fix the issue.
¯_(ツ)_/¯
That would be more helpful and customizable than the current implementation. I'd still want to append the output at the very least. Like the example above, I'd want to share multiple links.
Sounds good, an optional message that is printed after \n\n and the current text seems ok. Not of interest to me personally but happy to review a PR.
Will share my thoughts at the moment.
I believe that in many cases this is the case where you want to apply the policy. So instead of supporting custom messages, I think it should be better to make defining policies easy. This is tracked by #1358.
However, for some rules, it may be useful to be able to set custom messages. In that case, you can address it by changing the rule implementation. There are currently no plans to provide this as a feature of TFLint CLI.
Closing this issue based on the above. If you want to discuss more, please open a new discussion instead of an issue. Thanks.