tflint icon indicating copy to clipboard operation
tflint copied to clipboard

Enable local module inspection by default

Open wata727 opened this issue 3 years ago • 0 comments

Introduction

Currently, module inspection is disabled by default. This is because it needs to run terraform init to build the module tree. This decision was made to lower the hurdles for using TFLint as much as possible.

But for local modules, this assumption is not true. You can access the module content without running terraform init. Previously, local modules were built from the module manifest file just like any other module, so it was difficult to enable only local modules by default.

Proposal

By redesigning the Loader, the module tree can be built for local modules even without a module manifest file.

Change buildChildModules to move Loader's LoadModule logic under the terraform package. https://github.com/terraform-linters/tflint/blob/v0.39.3/terraform/config.go#L64-L112 https://github.com/terraform-linters/tflint/blob/v0.39.3/tflint/loader.go#L222-L277

References

https://github.com/terraform-linters/tflint/blob/v0.39.3/terraform/config.go#L64-L112 https://github.com/terraform-linters/tflint/blob/v0.39.3/tflint/loader.go#L222-L277

wata727 avatar Sep 05 '22 14:09 wata727