I want to create a cloud storage bucket programatically using deployment manager, but the deployment fails with the following error:
ERROR: (gcloud.deployment-manager.deployments.create) Error in Operation [operation-1626165906845-5c6fd413930ca-1a833b6c-81671664]: errors:
- code: RESOURCE_ERROR
location: /deployments/example-config/resources/storage-bucket
message: '{"ResourceType":"storage.v1.bucket","ResourceErrorCode":"403","ResourceErrorMessage":{"code":403,"errors":[{"domain":"global","message":"[email protected]
does not have storage.buckets.get access to the Google Cloud Storage bucket.","reason":"forbidden"}],"message":"[email protected]
does not have storage.buckets.get access to the Google Cloud Storage bucket.","statusMessage":"Forbidden","requestPath":"https://storage.googleapis.com/storage/v1/b/storage-bucket","httpMethod":"GET","suggestion":"Consider
granting permissions to [email protected]"}}'
However, I have added roles/storage-admin
to the account mentioned in the error, and according to Policy Troubleshooter access is granted for storage.buckets.get
API call:
This is the yaml
file I use:
imports:
- path: template.jinja
resources:
- name: template
type: template.jinja
properties:
storage:
bucket: qa-bucket-68586
and this is the jinja
template:
resources:
- name: storage-bucket
type: storage.v1.bucket
properties:
kind: storage#bucket
name: {{ properties["storage"]["bucket"] }}
location: EU
projectNumber: {{ env["project_number"] }}
storageClass: STANDARD