Resource
aws.s3.BucketCorsConfiguration
Example
let bucket = aws.s3.Bucket {
bucket = 'carina-example-cors-bucket'
tags = {
Environment = 'example'
}
}
aws.s3.BucketCorsConfiguration {
bucket = bucket.bucket
cors_rules = [
{
id = 'allow-example-get'
allowed_methods = [get]
# Replace with the browser origin that should be allowed.
allowed_origins = ['https://example.com']
allowed_headers = ['*']
expose_headers = ['ETag']
max_age_seconds = 3000
},
]
}
Argument Reference
bucket
- Type:
String - Required: Yes
Specifies the bucket impacted by the corsconfiguration.
cors_rules
- Type: List<Struct(CorsRule)> (items: 1..=100, ordered)
- Required: Yes
CORS rules to apply to the bucket.
Enum Values
cors_rules[].allowed_methods[] (HttpMethod)
| Value | DSL Identifier |
|---|---|
GET |
aws.s3.BucketCorsConfiguration.HttpMethod.get |
PUT |
aws.s3.BucketCorsConfiguration.HttpMethod.put |
HEAD |
aws.s3.BucketCorsConfiguration.HttpMethod.head |
POST |
aws.s3.BucketCorsConfiguration.HttpMethod.post |
DELETE |
aws.s3.BucketCorsConfiguration.HttpMethod.delete |
Shorthand formats: get or HttpMethod.get
Struct Definitions
cors_rules[]
| Field | Type | Required | Description |
|---|---|---|---|
id |
String (len: 0..=255) |
No | |
allowed_methods |
List<HttpMethod> (items: 1.., ordered) | Yes | |
allowed_origins |
List<String (pattern: /^[^*]*(?:\*[^*]*)?\z/ (Full))> (items: 1.., ordered) |
Yes | |
allowed_headers |
List<String (pattern: /^[^*]*(?:\*[^*]*)?\z/ (Full))> (ordered) |
No | |
expose_headers |
List<String> (ordered) |
No | |
max_age_seconds |
Int (range: -2147483648..=2147483647) |
No |