From 828e6ca3bc0cbc1fb03c5423d7f8ce0c2aec4812 Mon Sep 17 00:00:00 2001 From: drexler Date: Sun, 23 Feb 2020 21:39:01 -0500 Subject: [PATCH] docs: document S3 CORS configuration resource --- website/aws.erb | 3 ++ ...s3_bucket_cors_configuration.html.markdown | 51 +++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 website/docs/r/s3_bucket_cors_configuration.html.markdown diff --git a/website/aws.erb b/website/aws.erb index 4b09c1836d99..e5a8349a4563 100644 --- a/website/aws.erb +++ b/website/aws.erb @@ -2639,6 +2639,9 @@
  • aws_s3_bucket_analysis_configuration
  • +
  • + aws_s3_bucket_cors_configuration +
  • aws_s3_bucket_inventory
  • diff --git a/website/docs/r/s3_bucket_cors_configuration.html.markdown b/website/docs/r/s3_bucket_cors_configuration.html.markdown new file mode 100644 index 000000000000..0adf56f1d638 --- /dev/null +++ b/website/docs/r/s3_bucket_cors_configuration.html.markdown @@ -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. + +