Skip to content

Commit

Permalink
docs: document S3 CORS configuration resource
Browse files Browse the repository at this point in the history
  • Loading branch information
drexler committed Feb 24, 2020
1 parent 65a4be4 commit 828e6ca
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
3 changes: 3 additions & 0 deletions website/aws.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2639,6 +2639,9 @@
<li>
<a href="/docs/providers/aws/r/s3_bucket_analysis_configuration.html">aws_s3_bucket_analysis_configuration</a>
</li>
<li>
<a href="/docs/providers/aws/r/s3_bucket_cors_configuration.html">aws_s3_bucket_cors_configuration</a>
</li>
<li>
<a href="/docs/providers/aws/r/s3_bucket_inventory.html">aws_s3_bucket_inventory</a>
</li>
Expand Down
51 changes: 51 additions & 0 deletions website/docs/r/s3_bucket_cors_configuration.html.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
subcategory: "S3"
layout: "aws"
page_title: "AWS: aws_s3_bucket_cors_configuration"
description: |-
Provides a S3 bucket CORS configuration resource.
---

# Resource: aws_s3_bucket_cors_configuration

Provides a S3 bucket CORS configuration resource.

## Example Usage

```hcl
resource "aws_s3_bucket" "example" {
bucket = "example"
acl = "public-read"
}
resource "aws_s3_bucket_cors_configuration" "cors_policy" {
bucket = aws_s3_bucket.example.bucket
cors_rule {
allowed_headers = ["*"]
allowed_methods = ["PUT", "POST"]
allowed_origins = ["https://www.cors-configuration-test-create.com"]
expose_headers = ["x-amz-server-side-encryption", "ETag"]
max_age_seconds = 3000
}
}
```

## Argument Reference

The following arguments are supported:

* `bucket` - (Required) The name of the bucket to apply the CORS configuration to.

* `cors_rule` - (Required) A rule of [Cross-Origin Resource Sharing](https://docs.aws.amazon.com/AmazonS3/latest/dev/cors.html) (documented below).

The `CORS` object supports the following:

* `allowed_headers` (Optional) Specifies which headers are allowed.
* `allowed_methods` (Required) Specifies which methods are allowed. Can be `GET`, `PUT`, `POST`, `DELETE` or `HEAD`.
* `allowed_origins` (Required) Specifies which origins are allowed.
* `expose_headers` (Optional) Specifies expose header in the response.
* `max_age_seconds` (Optional) Specifies time in seconds that browser can cache the response for a preflight request.


0 comments on commit 828e6ca

Please sign in to comment.