Skip to content

Releases: chgasparoto/terraform-s3-object-notification

v2.0.2

20 Oct 08:22
111c07b
Compare
Choose a tag to compare

What's Changed

Full Changelog: v2.0.1...v2.0.2

v2.0.1

07 Sep 11:49
d5a210e
Compare
Choose a tag to compare

What's Changed

Full Changelog: v2.0.0...v2.0.1

v2.0.0

26 May 18:47
baf7d51
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v1.0.3...v2.0.0

v1.0.3

13 Mar 14:26
Compare
Choose a tag to compare

It adds the force_destroy variable for the module

  • Fix error in the conditional inside the notification submodule.

v1.0.2

13 Mar 13:01
Compare
Choose a tag to compare

It fixes sub-module Object key_prefix variable:

  • Fix if the variable is empty;
  • Make the Notification module create or not the resource based on the notification arrays.

v1.0.1

09 Feb 21:52
Compare
Choose a tag to compare

It fixes sub-modules outputs:

  • Add notifications output for the main module;
  • Remove useless commented outputs from the sub-modules.

v1.0.0 - First release

05 Feb 13:10
Compare
Choose a tag to compare

AWS S3 Terraform module

Terraform module to handle S3 buckets, bucket objects, and bucket notifications resources on AWS.

These types of resources are supported:

Usage

module "bucket" {
  source = "github.com/chgasparoto/terraform-s3-object-notification"
  
  name   = "my-super-unique-bucket-name"
  acl    = "public-read"
  policy = data.template_file.s3-public-policy.rendered

  versioning = {
    enabled = true
  }

  # This property activates the module to upload the files to the bucket.
  filepath = "${path.root}/../website/build/example"
  website = {
    index_document = "index.html"
    error_document = "index.html"
  }

  logging = {
    target_bucket = module.logs.name
    target_prefix = "access/"
  }

    notification_topic = [{
    topic_arn     = aws_sns_topic.topic.arn
    events        = "s3:ObjectCreated:*"
    filter_suffix = ".log"
  }]

  notification_queue = [{
    queue_arn     = aws_sqs_queue.queue.arn
    events        = "s3:ObjectCreated:*,s3:ObjectRemoved:*"
    filter_suffix = ".jpg"
  }]

  # This property creates the needed permissions for the bucket to be able to call the lambda.
  notification_lambda = [{
    lambda_function_arn = aws_lambda_function.func.arn
    events              = join(",", ["s3:ObjectCreated:*", "s3:ObjectRemoved:*])
    filter_suffix       = ".png"
  }]
}

Examples

Requirements

Name Version
terraform >= 0.12.10
aws >= 3.0

Inputs

Name Description Type Default Required
name Bucket unique name string null
acl Bucket ACL string private
policy Bucket Policy string
tags Bucket Tags map(string) {}
key_prefix Prefix to put your key(s) inside the bucket. E.g.: logs -> all files will be uploaded under logs/ string
filepath The local path where the desired files will be uploaded to the bucket string
versioning Map containing versioning configuration map(string) {}
website Map containing website configuration map(string) {}
logging Map containing logging configuration map(string) {}
notification_topic List of maps containing notification_topic configuration list(map(string)) [{}]
notification_queue List of maps containing notification_queue configuration list(map(string)) [{}]
notification_lambda List of maps containing notification_lambda configuration list(map(string)) [{}]

Outputs

Name Description
arn The ARN of the bucket. Will be of format arn:aws:s3:::bucketname
name Bucket name
website The website endpoint, if the bucket is configured with a website. If not, this will be an empty string
regional_domain_name The bucket region-specific domain name. E.g.: bucketname.s3.eu-central-1.amazonaws.com
domain_name The bucket domain name. Will be of format bucketname.s3.amazonaws.com
website_domain The domain of the website endpoint, if the bucket is configured with a website. If not, this will be an empty string. This is used to create Route 53 alias records.
hosted_zone_id The Route 53 Hosted Zone ID for this bucket's region
objects List of objects uploaded to the bucket

Authors

Module managed by Cleber Gasparoto

License

MIT