Google Cloud Storage Bucket Access Control

This page shows how to write Terraform for Cloud Storage Bucket Access Control and write them securely.

google_storage_bucket_access_control (Terraform)

The Bucket Access Control in Cloud Storage can be configured in Terraform with the resource name google_storage_bucket_access_control. The following sections describe 2 examples of how to use the resource and its parameters.

Example Usage from GitHub

resource "google_storage_bucket_access_control" "access-control-stock-ticker-bucket" {
  bucket =
  entity = ""
  role   = "OWNER"

resource "google_storage_bucket_access_control" "public_rule" {
  bucket =
  role   = "READER"
  entity = "allUsers"


  • bucket required - string
    • The name of the bucket.

  • domain requiredcomputed - string
    • The domain associated with the entity.

  • email requiredcomputed - string
    • The email address associated with the entity.

  • entity required - string
  • id optionalcomputed - string
  • role optional - string
    • The access permission for the entity. Possible values: ["OWNER", "READER", "WRITER"]

Explanation in Terraform Registry

Bucket ACLs can be managed authoritatively using the storage_bucket_acl resource. Do not use these two resources in conjunction to manage the same bucket. The BucketAccessControls resource manages the Access Control List (ACLs) for a single entity/role pairing on a bucket. ACLs let you specify who has access to your data and to what extent. There are three roles that can be assigned to an entity: READERs can get the bucket, though no acl property will be returned, and list the bucket's objects. WRITERs are READERs, and they can insert objects into the bucket and delete the bucket's objects. OWNERs are WRITERs, and they can get the acl property of a bucket, update a bucket, and call all BucketAccessControls methods on the bucket. For more information, see Access Control, with the caveat that this API uses READER, WRITER, and OWNER instead of READ, WRITE, and FULL_CONTROL. To get more information about BucketAccessControl, see:

Frequently asked questions

What is Google Cloud Storage Bucket Access Control?

Google Cloud Storage Bucket Access Control is a resource for Cloud Storage of Google Cloud Platform. Settings can be wrote in Terraform.

Where can I find the example code for the Google Cloud Storage Bucket Access Control?

For Terraform, the Blixk/basic_terraform_infrastructure and hizzuu/plate-terraform source code examples are useful. See the Terraform Example section for further details.


Scan your IaC problem in 3 minutes for free

You can keep your IaC security for free. No credit card required.