Home

Awesome

TFLint Ruleset Template

Build Status

This is a template repository for building a custom ruleset. You can create a plugin repository from "Use this template". See also Writing Plugins.

Requirements

Installation

TODO: This template repository does not contain release binaries, so this installation will not work. Please rewrite for your repository. See the "Building the plugin" section to get this template ruleset working.

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

plugin "template" {
  enabled = true

  version = "0.1.0"
  source  = "github.com/terraform-linters/tflint-ruleset-template"

  signing_key = <<-KEY
  -----BEGIN PGP PUBLIC KEY BLOCK-----
  mQINBGCqS2YBEADJ7gHktSV5NgUe08hD/uWWPwY07d5WZ1+F9I9SoiK/mtcNGz4P
  JLrYAIUTMBvrxk3I+kuwhp7MCk7CD/tRVkPRIklONgtKsp8jCke7FB3PuFlP/ptL
  SlbaXx53FCZSOzCJo9puZajVWydoGfnZi5apddd11Zw1FuJma3YElHZ1A1D2YvrF
  ...
  KEY
}

Rules

NameDescriptionSeverityEnabledLink
aws_instance_example_typeExample rule for accessing and evaluating top-level attributesERROR
aws_s3_bucket_example_lifecycle_ruleExample rule for accessing top-level/nested blocks and attributes under the blocksERROR
google_compute_ssl_policyExample rule with a custom rule configWARNING
terraform_backend_typeExample rule for accessing other than resourcesERROR

Building the plugin

Clone the repository locally and run the following command:

$ make

You can easily install the built plugin with the following:

$ make install

You can run the built plugin like the following:

$ cat << EOS > .tflint.hcl
plugin "template" {
  enabled = true
}
EOS
$ tflint