github.com/jpreese/tflint@v0.19.2-0.20200908152133-b01686250fb6/docs/guides/config.md (about)

     1  # Configuring TFLint
     2  
     3  You can change the behavior not only in CLI flags but also in configuration files. By default, TFLint looks up `.tflint.hcl` according to the following priority:
     4  
     5  - Current directory (`./.tflint.hcl`)
     6  - Home directory (`~/.tflint.hcl`)
     7  
     8  The config file is written in [HCL](https://github.com/hashicorp/hcl/tree/hcl2). An example is shown below:
     9  
    10  ```hcl
    11  config {
    12    module = true
    13    deep_check = true
    14    force = false
    15    disabled_by_default = false
    16  
    17    aws_credentials = {
    18      access_key = "AWS_ACCESS_KEY"
    19      secret_key = "AWS_SECRET_KEY"
    20      region     = "us-east-1"
    21    }
    22  
    23    ignore_module = {
    24      "github.com/terraform-linters/example-module" = true
    25    }
    26  
    27    varfile = ["example1.tfvars", "example2.tfvars"]
    28  
    29    variables = ["foo=bar", "bar=[\"baz\"]"]
    30  }
    31  
    32  rule "aws_instance_invalid_type" {
    33    enabled = false
    34  }
    35  
    36  rule "aws_instance_previous_type" {
    37    enabled = false
    38  }
    39  
    40  plugin "example" {
    41    enabled = true
    42  }
    43  ```
    44  
    45  You can also use another file as a config file with the `--config` option:
    46  
    47  ```
    48  $ tflint --config other_config.hcl
    49  ```
    50  
    51  ## `module`
    52  
    53  CLI flag: `--module`
    54  
    55  Enable [Module inspection](advanced.md#module-inspection).
    56  
    57  ## `deep_check`
    58  
    59  CLI flag: `--deep`
    60  
    61  Enable [Deep checking](advanced.md#deep-checking).
    62  
    63  ## `force`
    64  
    65  CLI flag: `--force`
    66  
    67  Return zero exit status even if issues found. TFLint returns non-zero exit status by default. See [Exit statuses](../../README.md#exit-statuses).
    68  
    69  ## `only`
    70  
    71  CLI flag: `--only`
    72  
    73  Only enable rules specifically enabled in the config or on the command line. All other rules, including defaults, are disabled. Note, usage of `--only` on the command line will ignore other rules passed in via `--enable-rule` or `--disabled-rule`. See [Only Mode](advanced.md#only-mode).
    74  
    75  ```hcl
    76  config {
    77    disabled_by_default = true
    78    # other options here...
    79  }
    80  
    81  rule "aws_instance_previous_type" {
    82    enabled = true
    83  }
    84  ```
    85  
    86  ## `aws_credentials`
    87  
    88  CLI flag: `--aws-access-key`, `--aws-secret-key`, `--aws-profile`, `--aws-creds-file` and `--aws-region`
    89  
    90  Configure AWS service crendetials. See [Credentials](credentials.md).
    91  
    92  ## `ignore_module`
    93  
    94  CLI flag: `--ignore-module`
    95  
    96  Skip inspections for the specified comma-separated module calls. Note that you need to pass module sources rather than module ids for backward compatibility. See [Module inspection](advanced.md#module-inspection).
    97  
    98  ## `varfile`
    99  
   100  CLI flag: `--var-file`
   101  
   102  Set Terraform variables from `tfvars` files. If `terraform.tfvars` or any `*.auto.tfvars` files are present, they will be automatically loaded.
   103  
   104  ## `variables`
   105  
   106  CLI flag: `--var`
   107  
   108  Set a Terraform variable from a passed value. This flag can be set multiple times.
   109  
   110  ## `rule` blocks
   111  
   112  CLI flag: `--enable-rule`, `--disable-rule`
   113  
   114  You can make settings for each rule in the `rule` block. All rules have the `enabled` attribute, and when it is false, the rule is ignored from inspection.
   115  
   116  ```hcl
   117  rule "aws_instance_previous_type" {
   118    enabled = false
   119  }
   120  ```
   121  
   122  Each rule can have its own configs. See the documentation for each rule for details.
   123  
   124  ## `plugin` blocks
   125  
   126  You can enable each plugin in the `plugin` block. Currently, it can set only `enabled` option. See [Extending TFLint](extend.md) for details.
   127  
   128  ```
   129  plugin "example" {
   130    enabled = true
   131  }
   132  ```