FEATURES PRICING ABOUT DOCS LOGIN

aws_s3_bucket_object

Provides a S3 bucket object resource.

Example Usage

Uploading a file to a bucket

resource "aws_s3_bucket_object" "object" {
	bucket = "your_bucket_name"
	key = "new_object_key"
	source = "path/to/file"
	etag = "${md5(file("path/to/file"))}"
}

Encrypting with KMS Key

resource "aws_kms_key" "examplekms" {
  description             = "KMS key 1"
  deletion_window_in_days = 7
}

resource "aws_s3_bucket" "examplebucket" {
  bucket = "examplebuckettftest"
  acl    = "private"
}

resource "aws_s3_bucket_object" "examplebucket_object" {
  key        = "someobject"
  bucket     = "${aws_s3_bucket.examplebucket.bucket}"
  source     = "index.html"
  kms_key_id = "${aws_kms_key.examplekms.arn}"
}

Argument Reference

The following arguments are supported:

Either source or content must be provided to specify the bucket content. These two arguments are mutually-exclusive.

Attributes Reference

The following attributes are exported


See the source of this document at Terraform.io

REQUEST A DEMO