我正在尝试使用以下资源配置使用Deployment Manager创建GCS存储桶:
resources:
- type: storage.v1.bucket
name: upload-bucket
properties:
project: <project-id>
name: <unique-bucket-name>
但是,出现以下错误:
- code: RESOURCE_ERROR
location: /deployments/the-bucket/resources/upload-bucket
message: '{"ResourceType":"storage.v1.bucket","ResourceErrorCode":"403","ResourceErrorMessage":{"code":403,"errors":[{"domain":"global","message":"205531008256@cloudservices.gserviceaccount.com
does not have storage.buckets.get access to upload-bucket.","reason":"forbidden"}],"message":"205531008256@cloudservices.gserviceaccount.com
does not have storage.buckets.get access to upload-bucket.","statusMessage":"Forbidden","requestPath":"https://www.googleapis.com/storage/v1/b/upload-bucket","httpMethod":"GET","suggestion":"Consider
granting permissions to 205531008256@cloudservices.gserviceaccount.com"}}'
205531008256@cloudservices.gserviceaccount.com
的角色默认情况下为Project Editor
(肯定具有足够的权限吗?),但是我也尝试添加Storage Admin
和Project Owner
-似乎都没有帮助。
我的两个问题是:
谢谢
答案 0 :(得分:1)
我遇到了完全相同的问题。请允许我更清楚地重申安德列斯S的答案。
当你写
resources:
- type: storage.v1.bucket
name: upload-bucket
properties:
project: <project-id>
name: <unique-bucket-name>
您可能打算创建一个名为<unique-bucket-name>
的存储桶,并发现upload-bucket
只是在Deployment Manager中引用该存储桶的名称。 GCP实际上所做的是尝试使用upload-bucket
作为实际的存储桶名称。据我所知,<unique-bucket-name>
从未使用过。这引起了一个问题,因为其他人已经拥有了存储桶upload-bucket
。
答案 1 :(得分:0)
尝试此代码,我想您是两次指定名称。
resources:
- type: storage.v1.bucket
name: <unique-bucket-name>
properties:
project: <project-id>
答案 2 :(得分:0)
我最近遇到了类似的问题,其中Deployment Manager无法创建存储桶。
我已确认:
在谷歌搜索之后,我发现还有另一种创建存储桶的方法。除了使用type: storage.v1.bucket
,您还可以使用type: gcp-types/storage-v1:buckets
。
所以我最终的解决方案是创建像这样的存储桶:
- name: images-bucket
type: gcp-types/storage-v1:buckets
properties:
name: images-my-project-name
location: "eu"