Resource
dcloud_bucket_cors
A bucket's CORS rules: which web pages may call the bucket from a browser (uploads with presigned URLs, fetch() from an app). Servers, the CLI and SDKs are not affected. Destroying it removes every rule.
Example Usage
resource "dcloud_bucket_cors" "uploads" {
bucket = dcloud_bucket.uploads.id
rules = jsonencode([
{
allowedOrigins = ["https://app.example.com"]
allowedMethods = ["GET", "PUT", "HEAD"]
allowedHeaders = ["*"]
exposeHeaders = ["ETag"]
maxAgeSeconds = 3600
},
])
}Schema
Required
bucket(String) The id of the parent resource ({name}in the path). Changing it replaces the resource.rules(String) The rules,[{ allowedOrigins, allowedMethods, allowedHeaders, exposeHeaders, maxAgeSeconds }]; usejsonencode.
Read-Only
id(String) The resource's id.
Import
Import is supported using the following syntax:
The terraform import command can be used, for example:
terraform import dcloud_bucket_cors.uploads <bucket-name>Generated from the provider's schema.
Related