terraform-aws-s3-bucket module. Variables are organized into logical groups to make them easier to navigate.
The module requires Terraform
>= 1.5.7 and the AWS provider >= 6.37.Bucket Configuration
(Optional, Forces new resource) The name of the bucket. If omitted, Terraform will assign a random, unique name.
(Optional, Forces new resource) Creates a unique bucket name beginning with the specified prefix. Conflicts with
bucket.Namespace for the bucket. Determines bucket naming scope. Valid values:
account-regional, global. Defaults to global (AWS).Region where the resource(s) will be managed. Defaults to the region set in the provider configuration.
Controls if S3 bucket should be created. Set to
false to conditionally skip bucket creation.A boolean that indicates all objects should be deleted from the bucket so that the bucket can be destroyed without error. These objects are not recoverable.
A mapping of tags to assign to the bucket.
The canned ACL to apply. Conflicts with
grant.A valid bucket policy JSON document. Note that if the policy document is not specific enough (but still valid), Terraform may view the policy as constantly changing in a
terraform plan. Use the verbose/specific version of the policy. Supports the placeholders _S3_BUCKET_ID_, _S3_BUCKET_ARN_, and _AWS_ACCOUNT_ID_.An ACL policy grant. Conflicts with
acl.Bucket owner’s display name and ID. Conflicts with
acl.The account ID of the expected bucket owner.
Access Control
Whether Amazon S3 should block public ACLs for this bucket.
Whether Amazon S3 should block public bucket policies for this bucket.
Whether Amazon S3 should ignore public ACLs for this bucket.
Whether Amazon S3 should restrict public bucket policies for this bucket.
Controls if a user defined public bucket policy will be attached. Set to
false to allow upstream to apply defaults to the bucket.Whether to skip destroying the S3 Bucket Public Access Block configuration when destroying the bucket. Only used if
public_access_block is set to true.Whether to manage S3 Bucket Ownership Controls on this bucket.
Object ownership. Valid values:
BucketOwnerEnforced— ACLs are disabled, and the bucket owner automatically owns and has full control over every object in the bucket.BucketOwnerPreferred— Objects uploaded to the bucket change ownership to the bucket owner if the objects are uploaded with thebucket-owner-full-controlcanned ACL.ObjectWriter— The uploading account will own the object if the object is uploaded with thebucket-owner-full-controlcanned ACL.
Encryption
Map containing server-side encryption configuration.
Controls if S3 bucket should deny incorrect encryption headers policy attached.
Controls if S3 bucket policy should deny usage of incorrect KMS key SSE.
The ARN of KMS key which should be allowed in PutObject. Used in conjunction with
attach_deny_incorrect_kms_key_sse.Controls if S3 bucket should deny unencrypted object uploads policy attached.
Controls if S3 bucket should deny SSEC (customer-provided key) encrypted object uploads.
Versioning & Object Lock
Map containing versioning configuration.
Whether S3 bucket should have an Object Lock configuration enabled.
Map containing S3 object locking configuration.
Lifecycle
List of maps containing configuration of object lifecycle management.
The default minimum object size behavior applied to the lifecycle configuration. Valid values:
all_storage_classes_128K (default), varies_by_storage_class.Replication
Map containing cross-region replication configuration.
Logging
Map containing access bucket logging configuration.
Controls if S3 bucket should have ELB log delivery policy attached.
Controls if S3 bucket should have ALB/NLB log delivery policy attached.
Controls if S3 bucket should have S3 access log delivery policy attached.
Controls if S3 bucket should have CloudTrail log delivery policy attached.
Controls if S3 bucket should have WAF log delivery policy attached.
List of S3 bucket ARNs which should be allowed to deliver access logs to this bucket.
List of AWS Account IDs that should be allowed to deliver access logs to this bucket.
List of AWS Organization IDs that should be allowed to deliver access logs to this bucket.
List of AWS Organization IDs that should be allowed to deliver ALB/NLB logs to this bucket.
Website & CORS
Map containing static web-site hosting or redirect configuration.
List of maps containing rules for Cross-Origin Resource Sharing.
Sets the accelerate configuration of an existing bucket. Can be
Enabled or Suspended.Specifies who should bear the cost of Amazon S3 data transfer. Can be either
BucketOwner or Requester. By default, the owner of the S3 bucket would incur the costs of any data transfer.Policies
Controls if S3 bucket should have bucket policy attached. Set to
true to use the value of policy as the bucket policy.Controls if S3 bucket should have a deny non-SSL transport policy attached.
Controls if S3 bucket should require the latest version of TLS.
Intelligent Tiering & Metrics
Map containing intelligent tiering configuration.
Map containing bucket metric configuration.
Inventory & Analytics
Map containing S3 inventory configuration.
The inventory source account ID.
The inventory source bucket ARN.
Whether or not the inventory source bucket is also the destination bucket.
Map containing bucket analytics configuration.
The analytics source account ID.
The analytics source bucket ARN.
Whether or not the analytics source bucket is also the destination bucket.
Controls if S3 bucket should have bucket inventory destination policy attached.
Controls if S3 bucket should have bucket analytics destination policy attached.
Directory Bucket
If the S3 bucket created is a directory bucket.
Availability Zone ID or Local Zone ID. Required for directory buckets.
Data redundancy. Valid values:
SingleAvailabilityZone.Bucket type. Valid values:
Directory.Location type. Valid values:
AvailabilityZone or LocalZone.Metadata
Whether to create a metadata configuration resource.
Configuration state of the inventory table, indicating whether the inventory table is enabled or disabled. Valid values:
ENABLED, DISABLED.Encryption configuration block for metadata.
Number of days to retain journal table records.
Whether journal table record expiration is enabled or disabled. Valid values:
ENABLED, DISABLED.
