tflint-ruleset-google
tflint-ruleset-google copied to clipboard
Better support and/or documentation for Credentials related to Deep Checking
From the Deep Checking documentation it says:
Currently, credentials, regions, etc. declared inside the "google" provider block are not considered except for the project attribute. You need to pass the credentials to TFLint using environment variables and so on.
We use tflint
pre-commit hooks to test our modules before developers make commits.
We also try to avoid adding providers within modules. From the Terraform Providers Within Modules documentation:
A module intended to be called by one or more other modules must not contain any
provider
blocks. A module containing its own provider configurations is not compatible with thefor_each
,count
, anddepends_on
arguments that were introduced in Terraform v0.13.
We DO add and configure a provider in examples/simple/main.tf
that developers can use for testing.
Is there a way that we can tell tflint
to use that provider OR is there a way that we can export the credentials? Looking at the code, the only thing we can set with environment variables (as far as I can tell) is the project, but it seems I also need to set at least zone or region.
Would it make sense to use the same exports for project, region, and zone as described in the Google Provider Default Values Configuration documentation?
Would it make sense to use the same exports for project, region, and zone as described in the Google Provider Default Values Configuration documentation?
Yes. Internally, like the Terraform provider, TFLint uses google.golang.org/api, so you able to use the same environment variables.
On the other hand, if you are developing child modules that are referenced by multiple root modules, deep checking may not make sense. This is because it is always intended to be run in a specific project.
Any improvements to the documentation are welcome!