Skip to content

utilitywarehouse/tflint-ruleset-kafka-config

Repository files navigation

TFLint kafka-config ruleset

This is a tflint plugin for enforcing UW rules over our kafka config.

Installation

You can install the plugin with tflint --init. Declare a config in .tflint.hcl as follows:

plugin "uw-kafka-config" {
  enabled = true

  version = "x.y.z"
  source  = "github.com/utilitywarehouse/tflint-ruleset-kafka-config"
}

Rules

Name Description
msk_module_backend Requires an S3 backend to be defined, with a key that has as suffix the name of the team (taken from the current directory name)
msk_app_topics Requires apps consume from and produce to only topics define in their module.
msk_topic_name Requires defined topics in a module to belong to that team.

Building the plugin

Clone the repository locally and run the following command:

$ make

You can easily install locally the built plugin with the following:

$ make install

You can run the built plugin like the following:

$ cat << EOS > .tflint.hcl
plugin "kafka-config" {
  enabled = true
}
EOS
$ tflint

Releasing

For releasing the binaries for the plugin you just need to create a Github release named vx.y.z, like v0.1.0.

Goreleaser is used in the pipeline. See config

Linting

Linting is handled via pre-commit. Follow the install instructions then install the hooks:

$ pre-commit install
$ pre-commit run --all-hooks