Skip to content

aws∕s3‒bucket‒object

GitHub Actions edited this page Feb 9, 2025 · 2 revisions

Usage

To use this module in your Terraform, refer to the below module example:

module "aws_s3_bucket_object" {
  source = "git::ssh://git@github.com/techpivot/terraform-modules-demo.git?ref=aws/s3-bucket-object/v1.0.2"

  # See inputs below for additional required parameters
}

Attributes

Requirements

Name Version
terraform >= 1.0
aws >= 5.27

Providers

Name Version
aws >= 5.27

Modules

No modules.

Resources

Name Type
aws_s3_object.this resource

Inputs

Name Description Type Default Required
acl The canned ACL to apply. Valid values are private, public-read, public-read-write, aws-exec-read, authenticated-read, bucket-owner-read, and bucket-owner-full-control. Defaults to private. string null no
bucket The name of the bucket to put the file in. Alternatively, an S3 access point ARN can be specified. string "" no
bucket_key_enabled Whether or not to use Amazon S3 Bucket Keys for SSE-KMS. bool null no
cache_control Specifies caching behavior along the request/reply chain. string null no
content Literal string value to use as the object content, which will be uploaded as UTF-8-encoded text. string null no
content_base64 Base64-encoded data that will be decoded and uploaded as raw bytes for the object content. This allows safely uploading non-UTF8 binary data, but is recommended only for small content such as the result of the gzipbase64 function with small text strings. For larger objects, use source to stream the content from a disk file. string null no
content_disposition Specifies presentational information for the object. string null no
content_encoding Specifies what content encodings have been applied to the object and thus what decoding mechanisms must be applied to obtain the media-type referenced by the Content-Type header field. string null no
content_language The language the content is in e.g. en-US or en-GB. string null no
content_type A standard MIME type describing the format of the object data, e.g. application/octet-stream. All Valid MIME Types are valid for this input. string null no
create Whether to create this resource or not? bool true no
etag Used to trigger updates. This attribute is not compatible with KMS encryption, kms_key_id or server_side_encryption = "aws:kms". string null no
file_source The path to a file that will be read and uploaded as raw bytes for the object content. string null no
force_destroy Allow the object to be deleted by removing any legal hold on any object version. Default is false. This value should be set to true only if the bucket has S3 object lock enabled. bool false no
key The name of the object once it is in the bucket. string "" no
kms_key_id Amazon Resource Name (ARN) of the KMS Key to use for object encryption. If the S3 Bucket has server-side encryption enabled, that value will automatically be used. If referencing the aws_kms_key resource, use the arn attribute. If referencing the aws_kms_alias data source or resource, use the target_key_arn attribute. Terraform will only perform drift detection if a configuration value is provided. string null no
metadata A map of keys/values to provision metadata (will be automatically prefixed by x-amz-meta-, note that only lowercase label are currently supported by the AWS Go API). map(string) {} no
object_lock_legal_hold_status The legal hold status that you want to apply to the specified object. Valid values are ON and OFF. string null no
object_lock_mode The object lock retention mode that you want to apply to this object. Valid values are GOVERNANCE and COMPLIANCE. string null no
object_lock_retain_until_date The date and time, in RFC3339 format, when this object's object lock will expire. string null no
override_default_tags Ignore provider default_tags. S3 objects support a maximum of 10 tags. bool false no
server_side_encryption Specifies server-side encryption of the object in S3. Valid values are "AES256" and "aws:kms". string null no
source_hash Triggers updates like etag but useful to address etag encryption limitations. Set using filemd5("path/to/source") (Terraform 0.11.12 or later). (The value is only stored in state and not saved by AWS.) string null no
storage_class Specifies the desired Storage Class for the object. Can be either STANDARD, REDUCED_REDUNDANCY, ONEZONE_IA, INTELLIGENT_TIERING, GLACIER, DEEP_ARCHIVE, or STANDARD_IA. Defaults to STANDARD. string null no
tags A map of tags to assign to the object. map(string) {} no
website_redirect Specifies a target URL for website redirect. string null no

Outputs

Name Description
s3_object_etag The ETag generated for the object (an MD5 sum of the object content).
s3_object_id The key of S3 object
s3_object_version_id A unique version ID value for the object, if bucket versioning is enabled.

Changelog

v1.0.2 (2024-10-28)

  • PR #9 - chore: update aws/vpc-endpoint module version and clean up assets
  • chore: bump version for s3-bucket-object

v1.0.1 (2024-10-09)

  • PR #2 - feat: update required Terraform version and add VPC endpoint ARN output
  • chore: update required Terraform version in versions.tf

v1.0.0 (2024-10-09)

  • PR #1 - docs: update readme with demo notice