Not able to lint the main modules if i call lint from source/application/calling module. #2275
Replies: 3 comments 2 replies
-
It's very hard to follow your question given the lack of proper formatting. Please make use of code fences and syntax highlighting if you want us to be able to discuss further. The module call docs should describe all of the behavior here: See Caveats for common misunderstandings. |
Beta Was this translation helpful? Give feedback.
-
Thank you @bendrucker for your response. To make it simple My folder hierarchy is
Content of each file mentioned below:
application1/linux_vm.tf:
application1/variables.tf:
application1/vars/abc.tfvars
modules/variables.tf
modules/vm.tf
so if i run tflint inside appliction1 i.e
After execution of above command its checking only in application1 folder not modules.
|
Beta Was this translation helpful? Give feedback.
-
Hi @bendrucker , Thank you for your insight but i read through the docs and its quite confusing with the term "You can inspect not only the root module but also [module calls](https://developer.hashicorp.com/terraform/language/modules/syntax#calling-a-child-module). TFLint evaluates each call (i.e. module block) and emits any issues that result from the specified input variables." application1/linux_vm.tf has source defined and its calling module ../modules/vm.tf . If the variable parameters i am passing doesn't get validated with ../modules/vm.tf , what does the module calls mean? Technically its not calling module at runtime but validating each and every file that's present inside the current directory where i am executing tflint with --recursive option providing --var-file option . So i am struggling to understand - what does "module call" mean? Thank You in advance for helping me understand it. |
Beta Was this translation helpful? Give feedback.
-
Hello ,
Can you please help me identifying the issue or identifying if its feasible or not.
My project structure (see referenced example repository!)
Repo-Module
├─── Module1
│ └─── module1.tf
│ └─── variblae1.tf
├─── Module2
│ └─── module2.tf
│ └─── variblae2.tf
Repo-Application:
├─── App1
│ └─── App1.tf - This app calls the module1 as source with actual variable present in variable1.tfvars
│ └─── variable1.tfvars
│ └─── .tflint.hcl
├─── App2
│ └─── App2.tf - This app calls the module2 as source with actual variable present in variable2.tfvars
│ └─── variable2.tfvars
│ └─── .tflint.hcl
If i am doing tflint in App1 folder in "Repo-Application" with --var-file="./varibale1.tfvars" option its only validating current folder tf files not the tf file present in "Repo-Module" . I believe its not calling recursively to modules being called as a source in app1.tf or app2.tf file.
Can you please help on providing insight on how can we implement it to call and validate modules present in another directory.
Beta Was this translation helpful? Give feedback.
All reactions