terraform-linters / tflint

A Pluggable Terraform Linter
Mozilla Public License 2.0
4.88k stars 354 forks source link

Support monorepo release versions for plugins #2034

Closed bharathkkb closed 5 months ago

bharathkkb commented 5 months ago

Introduction

We manage some of our TF tooling in a mono repo and would like to keep our custom plugin also in the mono repo. We follow a convention like pkg/vM.m.p when tagging releases (example: tflint-ruleset-foo/v0.1.0).

I tried to configure this like:

plugin "foo" {
    enabled = true
    version = "tflint-ruleset-foo/v0.1.0"
    source  = "github.com/org/monorepo"
}

However it seems like this does not working when installing plugins via tflint --init when as a "v" is prepended to resolve the tag name.

Proposal

One approach could be skipping the prepend of v if a semver with version is explicitly specified like version = "tflint-ruleset-foo/v0.1.0". Alternatively we could support an additional tag attrib like tag = "tflint-ruleset-foo/v0.1.0".

References

wata727 commented 5 months ago

Personally, I support adding the tag as a optional attribute. The logic for deciding whether to add v to the beginning of the version attribute is non-trivial, so there is a concern that it will become too complex.

However, if the tag attribute is introduced, the role of the version attribute will almost disappear, so I'm concerned that this will lead to unintuitive behavior for users. I think there is room for consideration on this point.