github.com/terraform-linters/tflint@v0.51.2-0.20240520175844-3750771571b6/docs/user-guide/working-directory.md (about)

     1  # Switching working directory
     2  
     3  TFLint has `--chdir` and `--recursive` flags to inspect modules that are different from the current directory.
     4  
     5  The `--chdir` flag is available just like Terraform:
     6  
     7  ```console
     8  $ tflint --chdir=environments/production
     9  ```
    10  
    11  Its behavior is the same as [Terraform's behavior](https://developer.hashicorp.com/terraform/cli/commands#switching-working-directory-with-chdir). You should be aware of the following points:
    12  
    13  - Config files are loaded after acting on the `--chdir` option.
    14    - This means that `tflint --chdir=dir` will loads `dir/.tflint.hcl` instead of `./.tflint.hcl`.
    15  - Relative paths are always resolved against the changed directory.
    16    - If you want to refer to the file in the original working directory, it is recommended to pass the absolute path using realpath(1) etc. e.g. `tflint --config=$(realpath .tflint.hcl)`.
    17  - The `path.cwd` represents the original working directory. This is the same behavior as using `--chdir` in Terraform.
    18  
    19  The `--recursive` flag enables recursive inspection. This is the same as running with `--chdir` for each directory.
    20  
    21  ```console
    22  $ tflint --recursive
    23  ```
    24  
    25  Recursive inspection is performed in parallel by default. The default parallelism is the number of CPUs. This can be controlled with `--max-workers`.
    26  
    27  These flags are also valid for `--init` and `--version`. Recursive init is required when installing required plugins all at once:
    28  
    29  ```console
    30  $ tflint --recursive --init
    31  $ tflint --recursive --version
    32  $ tflint --recursive
    33  ```