terraform-linters / tflint

A Pluggable Terraform Linter
Mozilla Public License 2.0
4.98k stars 357 forks source link

Redesign config schema #1953

Open wata727 opened 10 months ago

wata727 commented 10 months ago

Introduction

The .tflint.hcl configuration schema has remained largely unchanged since its design, but I believe there are better designs out there now. The current (v0.50) schema is shown below:

config {
  call_module_type    = string
  force               = bool
  ignore_module       = map(bool)
  varfile             = list(string)
  variables           = list(string)
  disabled_by_default = bool
  plugin_dir          = string
  format              = string
}

plugin "name" {
  enabled     = bool
  version     = string
  source      = string
  signing_key = string

  [plugin custom fields]
}

rule "name" {
  enabled = bool

  [plugin custom fields]
}

This schema has the following issues:

Proposal

Redesign config schema like below:

force               = bool
disabled_by_default = bool
plugin_dir          = string
format              = string

terraform {
  var_files = list(map)
  variables = {
    foo = "bar"
    baz = 1
  }
  ignore_modules   = list(string)
  call_module_type = string
}

plugin "name" {
  enabled     = bool
  version     = string
  source      = string
  signing_key = string

  _ {
    [plugin custom fields]
  }

  rule "name" {
    enabled = bool

    _ {
      [plugin custom fields]
    }
  }
}

However, this is a draft and we do not guarantee that it will be changed to this schema. The final version should be considered for backward compatibility and impact on changes.

References