Open wata727 opened 2 days ago
Fixes https://github.com/terraform-linters/tflint/issues/2051
Previously, --chdir and --recursive could not be used together.
--chdir
--recursive
$ tflint --chdir=infra --recursive Failed to find workspaces; cannot use --recursive and --chdir at the same time
This is because the --recursive was originally designed as --chdir for multi-directory https://github.com/terraform-linters/tflint/pull/1612 https://github.com/terraform-linters/tflint/pull/1622 Given this background, using them together was out of scope. Also, it is not obvious whether --recursive or --chdir takes precedence, which can lead to strange behavior when --recursive takes precedence.
However, given that terraform -chdir=infra fmt --recursive is a valid command, it is natural to expect similar behavior. In terraform fmt, -chdir takes precedence and recurses into the directory after the move. TFLint follows this behavior.
terraform -chdir=infra fmt --recursive
terraform fmt
-chdir
Fixes https://github.com/terraform-linters/tflint/issues/2051
Previously,
--chdir
and--recursive
could not be used together.This is because the
--recursive
was originally designed as--chdir
for multi-directory https://github.com/terraform-linters/tflint/pull/1612 https://github.com/terraform-linters/tflint/pull/1622 Given this background, using them together was out of scope. Also, it is not obvious whether--recursive
or--chdir
takes precedence, which can lead to strange behavior when--recursive
takes precedence.However, given that
terraform -chdir=infra fmt --recursive
is a valid command, it is natural to expect similar behavior. Interraform fmt
,-chdir
takes precedence and recurses into the directory after the move. TFLint follows this behavior.