salrashid123 / vault_gcp

Vault auth and secrets on GCP
Apache License 2.0
7 stars 3 forks source link

Fix: Error when login to Vault with generic_svc_account #2

Closed wayarmy closed 2 years ago

wayarmy commented 3 years ago

When i follow this tutorial, i got 2 error:

# vault write -field=token auth/gcp/login role="my-gce-role" jwt="$TOKEN"
Error writing data to auth/gcp/login: Error making API request.

URL: PUT http://localhost:8200/v1/auth/gcp/login
Code: 500. Errors:

* failed to create Compute HTTP client: failed to create oauth2 http client: failed to get default credentials: google: could not find default credentials. See https://developers.google.com/accounts/docs/application-default-credentials for more information.

and:

vault write -field=token auth/gcp/login     role="my-gce-role"      jwt="$TOKEN"
Error writing data to auth/gcp/login: Error making API request.

URL: PUT http://localhost:8200/v1/auth/gcp/login
Code: 400. Errors:

* error when attempting to find instance (project $PROJECT_ID, zone: asia-east1-a, instance: $INSTANCE_NAME) :unable to find instance associated with token: googleapi: Error 403: Required 'compute.instances.get' permission for 'projects/$PROJECT_ID/zones/asia-east1-a/instances/$INSTANCE_NAME', forbidden