I am trying to create GCP resources using a submodule, but I’m not able to get terraform to pass credential information.
I have a minimal failing case for viewing on this branch.
When running terraform plan
in the tf/gcp-docker-host/
directory, I get the expected plan. But when running terraform plan
from the root module directory tf/
, I get the following:
Error: Attempted to load application default credentials since neither `credentials` nor `access_token` was set in the provider block. No credentials loaded. To use your gcloud credentials, run 'gcloud auth application-default login'. Original error: google: could not find default credentials. See https://developers.google.com/accounts/docs/application-default-credentials for more information.
on <empty> line 0:
(source code not available)
It seems like terraform isn’t able to get the information from my credential file when it’s called from the root module even though it works as expected when called from the submodule.
Version info
$ terraform --version
Terraform v0.13.5
+ provider registry.terraform.io/hashicorp/google v3.34.0