Skip to content

Latest commit

 

History

History
170 lines (123 loc) · 5.23 KB

storage_object_access_control.html.markdown

File metadata and controls

170 lines (123 loc) · 5.23 KB
subcategory description
Cloud Storage
The ObjectAccessControls resources represent the Access Control Lists (ACLs) for objects within Google Cloud Storage.

google_storage_object_access_control

The ObjectAccessControls resources represent the Access Control Lists (ACLs) for objects within Google Cloud Storage. ACLs let you specify who has access to your data and to what extent.

There are two roles that can be assigned to an entity:

READERs can get an object, though the acl property will not be revealed. OWNERs are READERs, and they can get the acl property, update an object, and call all objectAccessControls methods on the object. The owner of an object is always an OWNER. For more information, see Access Control, with the caveat that this API uses READER and OWNER instead of READ and FULL_CONTROL.

To get more information about ObjectAccessControl, see:

## Example Usage - Storage Object Access Control Public Object
resource "google_storage_object_access_control" "public_rule" {
  object = google_storage_bucket_object.object.output_name
  bucket = google_storage_bucket.bucket.name
  role   = "READER"
  entity = "allUsers"
}

resource "google_storage_bucket" "bucket" {
  name     = "static-content-bucket"
  location = "US"
}

resource "google_storage_bucket_object" "object" {
  name   = "public-object"
  bucket = google_storage_bucket.bucket.name
  source = "../static/img/header-logo.png"
}

Argument Reference

The following arguments are supported:

  • bucket - (Required) The name of the bucket.

  • entity - (Required) The entity holding the permission, in one of the following forms:

  • object - (Required) The name of the object to apply the access control to.

  • role - (Required) The access permission for the entity. Possible values are: OWNER, READER.


Attributes Reference

In addition to the arguments listed above, the following computed attributes are exported:

  • id - an identifier for the resource with format {{bucket}}/{{object}}/{{entity}}

  • domain - The domain associated with the entity.

  • email - The email address associated with the entity.

  • entity_id - The ID for the entity

  • generation - The content generation of the object, if applied to an object.

  • project_team - The project team associated with the entity Structure is documented below.

The project_team block contains:

  • project_number - (Optional) The project team associated with the entity

  • team - (Optional) The team. Possible values are: editors, owners, viewers.

Timeouts

This resource provides the following Timeouts configuration options:

  • create - Default is 20 minutes.
  • update - Default is 20 minutes.
  • delete - Default is 20 minutes.

Import

ObjectAccessControl can be imported using any of these accepted formats:

  • {{bucket}}/{{object}}/{{entity}}

In Terraform v1.5.0 and later, use an import block to import ObjectAccessControl using one of the formats above. For example:

import {
  id = "{{bucket}}/{{object}}/{{entity}}"
  to = google_storage_object_access_control.default
}

When using the terraform import command, ObjectAccessControl can be imported using one of the formats above. For example:

$ terraform import google_storage_object_access_control.default {{bucket}}/{{object}}/{{entity}}