github.com/anuaimi/terraform@v0.6.4-0.20150904235404-2bf9aec61da8/website/source/docs/providers/aws/r/s3_bucket.html.markdown (about)

     1  ---
     2  layout: "aws"
     3  page_title: "AWS: aws_s3_bucket"
     4  sidebar_current: "docs-aws-resource-s3-bucket"
     5  description: |-
     6    Provides a S3 bucket resource.
     7  ---
     8  
     9  # aws\_s3\_bucket
    10  
    11  Provides a S3 bucket resource.
    12  
    13  ## Example Usage
    14  
    15  ### Private Bucket w/ Tags
    16  
    17  ```
    18  resource "aws_s3_bucket" "b" {
    19      bucket = "my_tf_test_bucket"
    20      acl = "private"
    21  
    22      tags {
    23          Name = "My bucket"
    24          Environment = "Dev"
    25      }
    26  }
    27  ```
    28  
    29  ### Static Website Hosting
    30  
    31  ```
    32  resource "aws_s3_bucket" "b" {
    33      bucket = "s3-website-test.hashicorp.com"
    34      acl = "public-read"
    35      policy = "${file("policy.json")}"
    36  
    37      website {
    38          index_document = "index.html"
    39          error_document = "error.html"
    40      }
    41  }
    42  ```
    43  
    44  ## Argument Reference
    45  
    46  The following arguments are supported:
    47  
    48  * `bucket` - (Required) The name of the bucket.
    49  * `acl` - (Optional) The [canned ACL](http://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#canned-acl) to apply. Defaults to "private".
    50  * `policy` - (Optional) A valid [bucket policy](http://docs.aws.amazon.com/AmazonS3/latest/dev/example-bucket-policies.html) JSON document. Note that if the policy document is not specific enough (but still valid), Terraform may view the policy as constantly changing in a `terraform plan`. In this case, please make sure you use the verbose/specific version of the policy.
    51  
    52  * `tags` - (Optional) A mapping of tags to assign to the bucket.
    53  * `force_destroy` - (Optional, Default:false ) A boolean that indicates all objects should be deleted from the bucket so that the bucket can be destroyed without error. These objects are *not* recoverable.
    54  * `website` - (Optional) A website object (documented below).
    55  
    56  The website object supports the following:
    57  
    58  * `index_document` - (Required, unless using `redirect_all_requests_to`) Amazon S3 returns this index document when requests are made to the root domain or any of the subfolders.
    59  * `error_document` - (Optional) An absolute path to the document to return in case of a 4XX error.
    60  * `redirect_all_requests_to` - (Optional) A hostname to redirect all website requests for this bucket to.
    61  
    62  ## Attributes Reference
    63  
    64  The following attributes are exported:
    65  
    66  * `id` - The name of the bucket.
    67  * `hosted_zone_id` - The [Route 53 Hosted Zone ID](http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_website_region_endpoints) for this bucket's region.
    68  * `region` - The AWS region this bucket resides in.
    69  * `website_endpoint` - The website endpoint, if the bucket is configured with a website. If not, this will be an empty string.
    70  * `website_domain` - The domain of the website endpoint, if the bucket is configured with a website. If not, this will be an empty string. This is used to create Route 53 alias records.