Error: google: could not find default credentials. for more information. on line 0: (source code not available)- Basically, the human user is the identity that needs access to a resource (the service account).
- Access to the PROJECT. Here, the identity is your service account which has Project Level Editor or Owner. Treating this SA as a 'resource', you simply grant the human user the 'UseServiceAccount' role on this resource.
- The Human User is what logs on to GCP (via gcloud or via cloud shell). To get this human user access to GCP, one needs the Cloud SDK (see below).
is to install Google Cloud SDK on your development desktop. On windows, just open up a powershell prompt and use this:
(New-Object Net.WebClient).DownloadFile("https://dl.google.com/dl/cloudsdk/channels/rapid/GoogleCloudSDKInstaller.exe", "$env:Temp\GoogleCloudSDKInstaller.exe")
& $env:Temp\GoogleCloudSDKInstaller.exe
Once installed, run the following gcloud commands
gcloud init --> THis will prompt you to use an existing gmail account or a different one gcloud auth application-default login
Google Auth Library was granted access to your Google Account [email protected]
You need this command to re-prompt a login. This will allow you to switch gmail identites. gcloud auth application-default login
gcloud projects create myprojectname
The Quick Fix - for callers must accept terms of service..
Log into the console with the same gSuite account and create a project by selecting 'select a project' (and 'Create a Project'). This will prompt the terms of service agreement and you may carry on after agreeing to the terms of service.
Some Roles your gmail identity may need on GCP for successfully creating Terraform Resources
- iam.serviceAccounts.actAs permission for your project - e.g. 'projects/my-awesome-project'
- If you plan to use the default compute engine SA, you would need to be granted the role - serviceAccountUser for that SA. Ask a project owner to grant you the iam.serviceAccountUser role on the service account
- If you will be creating your own SAs and assigning roles to them,
- resourcemanager.projects.getIamPolicy on the my-awesome-project
- resourcemanager.projects.setIamPolicy on the same project
- iam.roles.list - on the same project.