Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accept a directory as an argument #309

Merged
merged 1 commit into from
Jun 2, 2019
Merged

Accept a directory as an argument #309

merged 1 commit into from
Jun 2, 2019

Conversation

wata727
Copy link
Member

@wata727 wata727 commented Jun 1, 2019

Fixes #296

Currently, only files under the current directory are inspected, and an error occurs when passing a directory as an argument like the following:

$ tflint tests
Error: Failed to load `tests`: TFLint doesn't accept directories as arguments

Initially, this behavior was implemented as a respect to the Terraform behavior, but Terraform can accept a directory of configuration files as an argument. See https://www.terraform.io/docs/commands/plan.html

Based on the above, this PR makes TFLint accept a directory as an argument. However, as with Terraform, you cannot pass multiple directories.

$ tflint example tests
Error: Failed to load `example`: Multiple arguments are not allowed when passing a directory

Additionally, It also allows files not in the current directory to be accepted. In that case, the directory of the passed files is loaded, and only the issues of the passed files are reported. Therefore, please note that you cannot pass files in different directories at the same time.

$ tflint example/*.tf
Awesome! Your code is following the best practices :)
$ tflint example/*.tf terraform/*.tf
Error: Failed to load `terraform/cloudfront.tf`: Multiple files in different directories are not allowed

@wata727 wata727 marked this pull request as ready for review June 2, 2019 09:04
@wata727 wata727 merged commit 69c4efc into master Jun 2, 2019
@wata727 wata727 deleted the accept_directory branch June 2, 2019 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

File is not a target of Terraform
1 participant