-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
Terraform Validate returns error if called with initialised directory as argument #21769
Comments
Hi @Blokje5! Thanks for reporting this. The behavior you described, of looking for While I can definitely see the arguments both ways, we know that there are many existing examples of folks relying on the current behavior in their automation for various reasons, such as initializing the same configuration directory multiple times from different working directories and performing different operations in each. While we can debate the relative merits of these approaches in the abstract, we can't change the existing behavior without a lot of consideration of the consequences and tradeoffs. Interestingly, the most common direction this thought process has taken us in the past is in some sense the opposite of what you expected here: the prevailing idea right now is to remove the directory argument from every command except With all of this said, we recommend not relying on the directory arguments to these commands in general, because in any configuration that uses With all of that said, I think unfortunately the behavior you are seeing is the "correct" behavior in the sense of consistency with how the other commands behave and what existing systems are expecting. We don't have any current plans to change the design here, because our attentions are currently elsewhere and most users are able to follow our recommendation to Because there are no immediate plans to change this, I'm going to close this out. It's likely we'll open other issues in future representing specific plans, but those will depend on some more user research to figure out which of the several competing (and contradictory) approaches is likely to be helpful in the most scenarios. Thanks again for reporting this! |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
When I run
terraform validate <path>
I get the following error:Error: Module not installed
. It seems as if it uses the current folder to check for the.terraform
folder, instead of at the given path.Terraform Version
Debug Output
When calling
terraform validate environments/int
the following output is returnedWhen calling
terraform validate
from inside theenvironments/int
folder:Expected Behavior
Passing a path to terraform validate should use the .terraform directory at that path, correctly validating the code.
Actual Behavior
Terraform complains that the modules have not been initialised. It seems as if it checks for the .terraform folder at the current path, not the path that is specified as argument.
Steps to Reproduce
/modules/module-name
)environments/test
.terraform validate environments/test
. This should yield:Error: Module not installed
terraform validate
. This should return the normal validate output.The text was updated successfully, but these errors were encountered: