github.com/nathanielks/terraform@v0.6.1-0.20170509030759-13e1a62319dc/website/source/docs/providers/aws/r/s3_bucket_policy.html.markdown (about)

     1  ---
     2  layout: "aws"
     3  page_title: "AWS: aws_s3_bucket_policy"
     4  sidebar_current: "docs-aws-resource-s3-bucket-policy"
     5  description: |-
     6    Attaches a policy to an S3 bucket resource.
     7  ---
     8  
     9  # aws\_s3\_bucket\_policy
    10  
    11  Attaches a policy to an S3 bucket resource.
    12  
    13  ## Example Usage
    14  
    15  ### Using versioning
    16  
    17  ```hcl
    18  resource "aws_s3_bucket" "b" {
    19    # Arguments
    20  }
    21  
    22  data "aws_iam_policy_document" "b" {
    23    # Policy statements
    24  }
    25  
    26  resource "aws_s3_bucket_policy" "b" {
    27    bucket = "${aws_s3_bucket.b.id}"
    28    policy = "${data.aws_iam_policy_document.b.json}"
    29  }
    30  ```
    31  
    32  ## Argument Reference
    33  
    34  The following arguments are supported:
    35  
    36  * `bucket` - (Required) The name of the bucket to which to apply the policy.
    37  * `policy` - (Required) The text of the policy.