Skip to content
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

Better support and/or documentation for Credentials related to Deep Checking #327

Open
nshenry03 opened this issue Jan 24, 2024 · 1 comment

Comments

@nshenry03
Copy link

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 the for_each, count, and depends_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?

@wata727
Copy link
Member

wata727 commented Jan 24, 2024

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants