terraform-provider-google/website/docs/r/storage_bucket_object.html.markdown
The Magician 7bb31825b4 Add note about sensitive content to gcs bucket object (#3284)
Signed-off-by: Modular Magician <magic-modules@google.com>
2019-03-19 17:38:48 -07:00

3.2 KiB

layout page_title sidebar_current description
google Google: google_storage_bucket_object docs-google-storage-bucket-object Creates a new object inside a specified bucket

google_storage_bucket_object

Creates a new object inside an existing bucket in Google cloud storage service (GCS). ACLs can be applied using the google_storage_object_acl resource. For more information see the official documentation and API.

Example Usage

Example creating a public object in an existing image-store bucket.

resource "google_storage_bucket_object" "picture" {
  name   = "butterfly01"
  source = "/images/nature/garden-tiger-moth.jpg"
  bucket = "image-store"
}

Argument Reference

The following arguments are supported:

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

  • name - (Required) The name of the object. If you're interpolating the name of this object, see output_name instead.

One of the following is required:

  • content - (Optional, Sensitive) Data as string to be uploaded. Must be defined if source is not. Note: The content field is marked as sensitive. To view the raw contents of the object, please define an output.

  • source - (Optional) A path to the data you want to upload. Must be defined if content is not.


  • cache_control - (Optional) Cache-Control directive to specify caching behavior of object data. If omitted and object is accessible to all anonymous users, the default will be public, max-age=3600

  • content_disposition - (Optional) Content-Disposition of the object data.

  • content_encoding - (Optional) Content-Encoding of the object data.

  • content_language - (Optional) Content-Language of the object data.

  • content_type - (Optional) Content-Type of the object data. Defaults to "application/octet-stream" or "text/plain; charset=utf-8".

  • storage_class - (Optional) The StorageClass of the new bucket object. Supported values include: MULTI_REGIONAL, REGIONAL, NEARLINE, COLDLINE. If not provided, this defaults to the bucket's default storage class or to a standard class.

Attributes Reference

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

  • crc32c - (Computed) Base 64 CRC32 hash of the uploaded data.

  • md5hash - (Computed) Base 64 MD5 hash of the uploaded data.

  • self_link - (Computed) A url reference to this object.

  • output_name - (Computed) The name of the object. Use this field in interpolations with google_storage_object_acl to recreate google_storage_object_acl resources when your google_storage_bucket_object is recreated.