Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support custom messages when failing tflint checks #768

Closed
nitrocode opened this issue May 21, 2020 · 6 comments
Closed

feat: support custom messages when failing tflint checks #768

nitrocode opened this issue May 21, 2020 · 6 comments

Comments

@nitrocode
Copy link

Would be nice to be able to define custom messages in every rule to either overwrite or append tflint's default message

@bendrucker
Copy link
Member

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?

@nitrocode
Copy link
Author

nitrocode commented May 21, 2020

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."
}

@bendrucker
Copy link
Member

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.

@nitrocode
Copy link
Author

¯_(ツ)_/¯

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.

@bendrucker
Copy link
Member

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.

@wata727
Copy link
Member

wata727 commented Dec 28, 2022

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.

@wata727 wata727 closed this as not planned Won't fix, can't repro, duplicate, stale Dec 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants