I want to have a service account on Google Cloud that can only write objects to a specific storage Cloud Storage bucket. I have already created the service account using deployment manager and now try to create a bucket with the requisite bindings
def GenerateConfig(context):
"""Generate configuration for a cloud storage bucket for experiment data."""
resources = []
resources.append({
'type': 'storage.v1.bucket',
'name': 'mybucket',
'properties': {
'predefinedAcl': 'projectPrivate',
'projection': 'full',
'location': 'europe-west2',
'storageClass': 'STANDARD',
'bindings': {
'role': 'roles/storage.objectCreator',
'member': 'serviceAccount:my-service@my-project.iam.gserviceaccount.com',
}
}
})
return {'resources': resources}
If I create this deployment using deployment manager I can see the new bucket and I can see the bucket associated with the deployment has the bindings
member: serviceAccount:my-service@my-project.iam.gserviceaccount.com
role: roles/storage.objectCreator
However if I use this service account to write a file to this cloud storage bucket it fails with a 403 as:
"errors": [
{
"message": "my-service@my-project.iam.gserviceaccount.com does not have storage.objects.create access to the Google Cloud Storage object.",
"domain": "global",
"reason": "forbidden"
}
]
If I then use the policy analyser to see what permissions this service account has it returns nothing. What have I misunderstood? Is it not possible to create a service account that can only access certain buckets or must it have access to all buckets on a project?