github.com/wata727/tflint@v0.12.2-0.20191013070026-96dd0d36f385/README.md (about)

     1  # TFLint
     2  [![Build Status](https://travis-ci.org/wata727/tflint.svg?branch=master)](https://travis-ci.org/wata727/tflint)
     3  [![GitHub release](https://img.shields.io/github/release/wata727/tflint.svg)](https://github.com/wata727/tflint/releases/latest)
     4  [![Terraform Compatibility](https://img.shields.io/badge/terraform-%3E%3D%200.12-blue)](docs/guides/compatibility.md)
     5  [![Docker Hub](https://img.shields.io/badge/docker-ready-blue.svg)](https://hub.docker.com/r/wata727/tflint/)
     6  [![License: MPL 2.0](https://img.shields.io/badge/License-MPL%202.0-blue.svg)](LICENSE)
     7  [![Go Report Card](https://goreportcard.com/badge/github.com/wata727/tflint)](https://goreportcard.com/report/github.com/wata727/tflint)
     8  
     9  TFLint is a [Terraform](https://www.terraform.io/) linter focused on possible errors, best practices, etc.
    10  
    11  ## Why TFLint is required?
    12  
    13  Terraform is a great tool for Infrastructure as Code. However, many of these tools don't validate provider-specific issues. For example, see the following configuration file:
    14  
    15  ```hcl
    16  resource "aws_instance" "foo" {
    17    ami           = "ami-0ff8a91507f77f867"
    18    instance_type = "t1.2xlarge" # invalid type!
    19  }
    20  ```
    21  
    22  Since `t1.2xlarge` is a nonexistent instance type, an error will occur when you run `terraform apply`. But `terraform plan` and `terraform validate` cannot find this possible error beforehand. That's because it's an AWS provider-specific issue and it's valid as a Terraform configuration.
    23  
    24  TFLint finds such errors in advance:
    25  
    26  ![demo](docs/assets/demo.gif)
    27  
    28  ## Installation
    29  
    30  You can download the binary built for your architecture from [the latest release](https://github.com/wata727/tflint/releases/latest). The following is an example of installation on macOS:
    31  
    32  ```console
    33  $ wget https://github.com/wata727/tflint/releases/download/v0.12.1/tflint_darwin_amd64.zip
    34  $ unzip tflint_darwin_amd64.zip
    35  Archive:  tflint_darwin_amd64.zip
    36    inflating: tflint
    37  $ mkdir -p /usr/local/tflint/bin
    38  $ export PATH=/usr/local/tflint/bin:$PATH
    39  $ install tflint /usr/local/tflint/bin
    40  $ tflint -v
    41  ```
    42  
    43  For Linux based OS, you can use the [`install_linux.sh`](https://raw.githubusercontent.com/wata727/tflint/master/install_linux.sh) to automate the installation process, or try the following oneliner to download latest binary for AMD64 architecture.
    44  ```
    45  $ curl -L "$(curl -s https://api.github.com/repos/wata727/tflint/releases/latest | grep -o -E "https://.+?_linux_amd64.zip")" > tflint.zip && unzip tflint.zip && rm tflint.zip
    46  ```
    47  
    48  ### Homebrew
    49  
    50  macOS users can also use [Homebrew](https://brew.sh) to install TFLint:
    51  
    52  ```console
    53  $ brew install tflint
    54  ```
    55  
    56  ### Docker
    57  
    58  You can also use [TFLint via Docker](https://hub.docker.com/r/wata727/tflint/).
    59  
    60  ```console
    61  $ docker run --rm -v $(pwd):/data -t wata727/tflint
    62  ```
    63  
    64  ## Features
    65  
    66  700+ rules are available. See [Rules](docs/rules).
    67  
    68  ## Limitations
    69  
    70  TFLint currently only inspects Terraform-specific issues and AWS issues.
    71  
    72  Also, load configurations in the same way as Terraform v0.12. This means that it cannot inspect configurations that cannot be parsed on Terraform v0.12.
    73  
    74  See [Compatibility with Terraform](docs/guides/compatibility.md) for details.
    75  
    76  ## Usage
    77  
    78  TFLint inspects all configurations under the current directory by default. You can also change the behavior with the following options:
    79  
    80  ```
    81  $ tflint --help
    82  Usage:
    83    tflint [OPTIONS] [FILE or DIR...]
    84  
    85  Application Options:
    86    -v, --version                             Print TFLint version
    87        --langserver                          Start language server
    88    -f, --format=[default|json|checkstyle]    Output format (default: default)
    89    -c, --config=FILE                         Config file name (default: .tflint.hcl)
    90        --ignore-module=SOURCE                Ignore module sources
    91        --enable-rule=RULE_NAME               Enable rules from the command line
    92        --disable-rule=RULE_NAME              Disable rules from the command line
    93        --var-file=FILE                       Terraform variable file name
    94        --var='foo=bar'                       Set a Terraform variable
    95        --module                              Inspect modules
    96        --deep                                Enable deep check mode
    97        --aws-access-key=ACCESS_KEY           AWS access key used in deep check mode
    98        --aws-secret-key=SECRET_KEY           AWS secret key used in deep check mode
    99        --aws-profile=PROFILE                 AWS shared credential profile name used in deep check mode
   100        --aws-creds-file=FILE                 AWS shared credentials file path used in deep checking
   101        --aws-region=REGION                   AWS region used in deep check mode
   102        --force                               Return zero exit status even if issues found
   103        --no-color                            Disable colorized output
   104  
   105  Help Options:
   106    -h, --help                                Show this help message
   107  ```
   108  
   109  See [User guide](docs/guides) for each option.
   110  
   111  ## Exit Statuses
   112  
   113  TFLint returns the following exit statuses on exit:
   114  
   115  - 0: No issues found
   116  - 2: Errors occurred
   117  - 3: No errors occurred, but issues found
   118  
   119  ## Debugging
   120  
   121  If you don't get the expected behavior, you can see the detailed logs when running with `TFLINT_LOG` environment variable.
   122  
   123  ```console
   124  $ TFLINT_LOG=debug tflint
   125  ```
   126  
   127  ## Developing
   128  
   129  See [Developer guide](docs/DEVELOPING.md).
   130  
   131  ## Author
   132  
   133  [Kazuma Watanabe](https://github.com/wata727)