Skip to content

Latest commit

 

History

History
33 lines (23 loc) · 1.48 KB

working-directory.md

File metadata and controls

33 lines (23 loc) · 1.48 KB

Switching working directory

TFLint has --chdir and --recursive flags to inspect modules that are different from the current directory.

The --chdir flag is available just like Terraform:

$ tflint --chdir=environments/production

Its behavior is the same as Terraform's behavior. You should be aware of the following points:

  • Config files are loaded after acting on the --chdir option.
    • This means that tflint --chdir=dir will loads dir/.tflint.hcl instead of ./.tflint.hcl.
  • Relative paths are always resolved against the changed directory.
    • 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).
  • The path.cwd represents the original working directory. This is the same behavior as using --chdir in Terraform.

The --recursive flag enables recursive inspection. This is the same as running with --chdir for each directory.

$ tflint --recursive

Recursive inspection is performed in parallel by default. The default parallelism is the number of CPUs. This can be controlled with --max-workers.

These flags are also valid for --init and --version. Recursive init is required when installing required plugins all at once:

$ tflint --recursive --init
$ tflint --recursive --version
$ tflint --recursive