无法使用 gcloud 为 iam 帐户 GCP 创建密钥文件

Unable to create key file for iam account GCP using gcloud

我正在尝试使用 gcloud 在 GCP 上为服务帐户创建密钥文件

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

很遗憾,它有响应

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

文件夹

 '~/.config/gcloud/'

存在。

问题是:

'~/.config/gcloud/'

这应该是

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

正如 John Hanley 正确指出的那样。