1
votes

I am trying to create a key file for a service account on GCP with gcloud

gcloud iam service-accounts keys create ~/.config/gcloud/key.json \
--iam-account terraform@$myproject.iam.gserviceaccount.com

Unfortunately, it responds

(gcloud) Unable to create private file [~/.config/gcloud/key.json]: [Errno 2] No such file or directory: '~/.config/gcloud/key.json'

The folder

 '~/.config/gcloud/'

exists.

1
What happens if you specify the full pathname? What is the output from whoami? What is the output from ls -ld ~/.config/gcloud?John Hanley
full pathname works!Mike

1 Answers

5
votes

the problem is:

'~/.config/gcloud/'

this should be

'/home/mike/.config/gcloud/'

as John Hanley correctly pointed out.