问题
根据google 的文档:
https://cloud.google.com/storage/docs/reporting-changes#command-line
明确表示, 要创建storage notificaiton , 创建者(or service account) 只需要bucket 和 pubsub admin roles
但是实际上我在公司尝试为1个bucket 创建 notification 时遇到了错误:
ERROR: (gcloud.storage.buckets.notifications.create) User [xxxxx] does not have permission to access b instance [xxxx] (or it may not exist):
xxxxx does not have serviceusage.services.use access to the Google Cloud project. Permission 'serviceusage.services.use' denied on resource (or it may not exist). This command is authenticated as xxxxx which is the active account specified by the [core/account] property.
首先什么是b instance, serviceusage.services.us 又是什么权限
由于我在公司所用的账号是terraform用的账号, 权限我相信是足够的, 也具有pubsub 和 bucket admin 的roles.
而且这个账号之前是创建过其他notification的
尝试几次后, 够钟收工
尝试在家里reproduce 这个issue
首先创建 1个service account, 并且分配权限
account name 就叫 pubsub-bucket-adm
tf 脚本:
# create a resource for a new service account
resource "google