2015-05-21 17:28:27 +00:00
---
layout: "google"
page_title: "Google: google_storage_bucket"
2015-10-23 14:10:41 +00:00
sidebar_current: "docs-google-storage-bucket"
2015-05-21 17:28:27 +00:00
description: |-
Creates a new bucket in Google Cloud Storage.
---
# google\_storage\_bucket
Creates a new bucket in Google cloud storage service(GCS). Currently, it will not change location nor ACL once a bucket has been created with Terraform. For more information see [the official documentation ](https://cloud.google.com/storage/docs/overview ) and [API ](https://cloud.google.com/storage/docs/json_api ).
## Example Usage
2016-03-31 10:37:17 +00:00
Example creating a private bucket in standard storage, in the EU region.
2015-05-21 17:28:27 +00:00
2016-04-10 21:34:15 +00:00
```js
2015-05-21 17:28:27 +00:00
resource "google_storage_bucket" "image-store" {
2016-04-10 21:34:15 +00:00
name = "image-store-bucket"
location = "EU"
2015-05-21 17:28:27 +00:00
2016-04-10 21:34:15 +00:00
website {
main_page_suffix = "index.html"
2017-02-18 22:48:50 +00:00
not_found_page = "404.html"
2016-04-10 21:34:15 +00:00
}
}
2015-05-21 17:28:27 +00:00
```
## Argument Reference
2015-09-15 14:54:16 +00:00
The following arguments are supported:
2015-05-21 17:28:27 +00:00
* `name` - (Required) The name of the bucket.
2016-04-10 21:34:15 +00:00
- - -
* `force_destroy` - (Optional, Default: false) When deleting a bucket, this
boolean option will delete all contained objects. If you try to delete a
bucket that contains objects, Terraform will fail that run.
* `location` - (Optional, Default: 'US') The [GCS location ](https://cloud.google.com/storage/docs/bucket-locations )
2015-09-16 18:46:46 +00:00
* `predefined_acl` - (Optional, Deprecated) The [canned GCS ACL ](https://cloud.google.com/storage/docs/access-control#predefined-acl ) to apply. Please switch
to `google_storage_bucket_acl.predefined_acl` .
2016-04-10 21:34:15 +00:00
* `project` - (Optional) The project in which the resource belongs. If it
is not provided, the provider project is used.
2017-02-17 14:59:25 +00:00
* `storage_class` - (Optional) The [Storage Class ](https://cloud.google.com/storage/docs/storage-classes ) of the new bucket. Supported values include: `MULTI_REGIONAL` , `REGIONAL` , `NEARLINE` , `COLDLINE` .
2016-09-21 19:46:35 +00:00
2016-04-10 21:34:15 +00:00
* `website` - (Optional) Configuration if the bucket acts as a website.
2015-09-15 14:54:16 +00:00
The optional `website` block supports:
2016-04-10 21:34:15 +00:00
* `main_page_suffix` - (Optional) Behaves as the bucket's directory index where
missing objects are treated as potential directories.
* `not_found_page` - (Optional) The custom object to return when a requested
resource is not found.
2015-09-15 14:54:16 +00:00
## Attributes Reference
2016-04-10 21:34:15 +00:00
In addition to the arguments listed above, the following computed attributes are
exported:
2015-09-15 14:54:16 +00:00
* `self_link` - The URI of the created resource.