-
-
Notifications
You must be signed in to change notification settings - Fork 541
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
Validate without variables fails when there is a subfolder present with TF code #59
Comments
Hi Przemyslaw! Thanks for opening this issue. Yes,
I have not tried to reproduce the issue you are talking about, and I am not sure what we can do with this in this project (and whether we should?). Please share your ideas. |
Greetings, Sorry to "reopen" this issue after two months. But I ran into kind of same problem today. Architecture
ProblemIf you have a module inside another module and that the modules are all defined with a source type local_path; then the pre-commit terraform validate will not work and return errors. It is kind of logical since in the documentation of Terraform, it is written that the local_path modules are not really installed. Of course, I try all the basics, such as Errors
SuggestionI discovered that the If you have any suggestion or workaround to help us with this problem, thank you for sharing them. |
This may be a known issue with Terraform. See hashicorp/terraform#21769. Specifically:
Manually, I validated that running [AutoScaling]$ terraform validate
Success! The configuration is valid.
[AutoScaling]$ echo $?
0
[AutoScaling]$ cd test/
[test]$ terraform validate
Success! The configuration is valid.
[test]$ echo $?
0 While [AutoScaling]$ terraform validate test
Error: Module not installed
on test/main.tf line 5:
5: module "autoscaling" {
This module is not yet installed. Run "terraform init" to install all modules
required by this configuration.
[AutoScaling]$ terraform validate test
Error: Module not installed
on test/main.tf line 5:
5: module "autoscaling" {
This module is not yet installed. Run "terraform init" to install all modules
required by this configuration. |
So, reading into hashicorp/terraform#21769, running Does terraform validate from the root validate all referenced files from submodules? At least variable references, I believe it does. |
Closing this issue. I have released an updated version (v1.44.0 ) where See #158 and updated terraform-aws-modules/terraform-aws-lambda#68 - here you can see how I use both |
Hi
My modules contains examples/ folder with implementation example. After upgrade of pre-commit-terraform and my code to 0.12.x the validate without variables stopped working for subfolders complaining that module wasn't initialised but it actually was.
My hook config:
The text was updated successfully, but these errors were encountered: