Documentation Index
Fetch the complete documentation index at: https://mintlify.com/terraform-aws-modules/terraform-aws-s3-bucket/llms.txt
Use this file to discover all available pages before exploring further.
Object submodule
Themodules/object submodule lets you manage individual S3 objects as Terraform resources. Use it when you need to upload configuration files, static assets, or seed data as part of your infrastructure.
Object variables
| Variable | Description |
|---|---|
bucket | Name or ARN of the target bucket |
key | Object key (path within the bucket) |
file_source | Path to a local file to upload |
content | Literal UTF-8 string content |
content_base64 | Base64-encoded binary content |
content_type | MIME type (e.g. application/json) |
storage_class | Storage class for the object |
server_side_encryption | "AES256" or "aws:kms" |
kms_key_id | KMS key ARN for SSE-KMS |
bucket_key_enabled | Use S3 Bucket Keys for SSE-KMS |
object_lock_mode | "GOVERNANCE" or "COMPLIANCE" |
object_lock_retain_until_date | Retention date in RFC3339 format |
force_destroy | Allow deletion when Object Lock is enabled |
metadata | Map of x-amz-meta-* metadata keys |
tags | Tags to assign to the object |
CORS configuration
Cross-Origin Resource Sharing (CORS) allows web applications from other domains to make requests to your bucket. Configure it with thecors_rule variable:
CORS rule fields
| Field | Required | Description |
|---|---|---|
allowed_methods | Yes | HTTP methods: GET, PUT, POST, DELETE, HEAD |
allowed_origins | Yes | Origins allowed to make cross-origin requests |
allowed_headers | No | Request headers the browser is allowed to send |
expose_headers | No | Response headers the browser can access |
max_age_seconds | No | Seconds the browser caches the preflight response |
id | No | Unique identifier for the rule |
CORS is not available for directory buckets.
Transfer Acceleration
Transfer Acceleration routes uploads through Amazon CloudFront edge locations, reducing latency for clients far from the bucket’s region:acceleration_status: "Enabled" or "Suspended".
Requester Pays
By default the bucket owner pays for data transfer. Setrequest_payer = "Requester" to charge the requester instead:
"BucketOwner" (default) or "Requester".
Intelligent-Tiering
Intelligent-Tiering automatically moves objects between access tiers based on usage patterns. Configure it with theintelligent_tiering map:
Intelligent-Tiering access tiers
| Tier | Minimum days | Description |
|---|---|---|
ARCHIVE_ACCESS | 90 | Objects not accessed for 90+ days |
DEEP_ARCHIVE_ACCESS | 180 | Objects not accessed for 180+ days |
CloudWatch metrics
Usemetric_configuration to publish per-prefix or per-tag request metrics to CloudWatch:
aws_s3_bucket_metric resource. Metrics appear in CloudWatch under the AWS/S3 namespace and are available for use in alarms and dashboards.
