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

File is not a target of Terraform #296

Closed
davewongillies opened this issue May 28, 2019 · 4 comments · Fixed by #309
Closed

File is not a target of Terraform #296

davewongillies opened this issue May 28, 2019 · 4 comments · Fixed by #309

Comments

@davewongillies
Copy link
Contributor

In versions prior to version 0.8.0 of tflint, I could run it like this:

$ tflint tests/*.tf
Awesome! Your code is following the best practices :)

So that it would test a directory of .tf files. Now with 0.8.0 if I do that, it does this:

tflint tests/*.tf
Error: Failed to load `tests/test.tf`: File is not a target of Terraform

If I tell it to just do the directory:

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

So my only recourse is to cd into the directory:

$ cd tests
$ tflint *.tf
Awesome! Your code is following the best practices :)

Is there some reason for this change in behaviour? Is this something that could be changed back to the prior behaviour?

@wata727
Copy link
Member

wata727 commented May 29, 2019

@davewongillies Thank you for trying the new version!

Sorry for making you confused about changing the behavior. I completely agree that this behavior is not intuitive. However, unfortunately, it is difficult to parse arbitrary files or directories.

In v0.8, we use Terraform's internal API for loading .tf files. As a result, TFLint also has the same limitations, as Terraform can only load one directory. See also #217

I thought that there was no problem if executed the tflint command in the same way as terraform command, but please let me know if you have any problems. I would like to consider a possible solution. Thanks again!

@davewongillies
Copy link
Contributor Author

@wata727 thanks for the response.

So I'm cool with (and unsurprised by) tflint tests/*.tf not working, since it doesn't match up with the existing behaviour of the terraform commands.

I would expect for tflint <path to directory> to work as that matches up with existing terraform commands.

@wata727
Copy link
Member

wata727 commented May 31, 2019

Maybe I misunderstand the behavior of Terraform. I will check it a bit more.

@wata727
Copy link
Member

wata727 commented Jun 2, 2019

v0.8.2 has been released, which can receive a directory as an argument.

@wata727 wata727 mentioned this issue Jun 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants