GOOGLE_OAUTH_ACCESS_TOKEN environment variable not working

As per the documentation here:

Concerning access_token, I would like to pass a temporary access token to the environment variable:
so that I can run my terraform using the temp access token without having to modify my terraform configuration.

I have tried to do the following, however it is not working and giving me the following error:

Error: Failed to get existing workspaces: querying Cloud Storage failed: googleapi: Error 401: Invalid Credentials, authError

I’m using google cloud and am generating the access token with gcloud:

gcloud auth print-access-token

I’ve also tried other means of generating access tokens such as impersonating a service account.

1 Like

I have similar problem, with another provider.
After apply i have in my state file:
Authorization": “Bearer eyJXXX…”
This token lifetime is 5min. So i can create resource, but after 5 min it cannot be deleted or changed because Authorization token has changed and i have old token in my state file.

1 Like