Skip to content

geekcell/terraform-aws-s3

Repository files navigation

Geek Cell GmbH

Code Quality

License GitHub release (latest tag) Release Validate Lint Test

Terraform AWS S3

This Terraform module provides a preconfigured solution for setting up AWS S3 buckets in your AWS account. With this module, you can easily and efficiently create and manage S3 buckets with advanced features such as transitions, security, encryption, and public access restriction. Our team has extensive experience working with AWS S3 and has optimized this module to provide the best possible experience for users.

By using this Terraform module, you can save time and effort in setting up and managing your S3 buckets, as well as ensure that your data is secure and protected. The module encapsulates all necessary configurations, making it easy to use and integrate into your existing AWS environment. Whether you are just getting started with AWS S3 or looking for a more efficient way to manage your buckets, this Terraform module provides a preconfigured solution with advanced features.

Inputs

Name Description Type Default Required
expiration The number of days after which to expunge the objects. number 0 no
name The name of the bucket. string n/a yes
noncurrent_version_expiration The number of days after which to delete the noncurrent object. number 90 no
noncurrent_version_transitions Transition to another storage class for noncurrent_versions.
list(object({
noncurrent_days = number
storage_class = string
}))
[
{
"noncurrent_days": 30,
"storage_class": "STANDARD_IA"
}
]
no
policy A valid bucket policy JSON document. string null no
tags Tags to add to the AWS Customer Managed Key. map(any) {} no
transitions Transition to another storage class.
list(object({
days = number
storage_class = string
}))
[
{
"days": 30,
"storage_class": "STANDARD_IA"
},
{
"days": 60,
"storage_class": "GLACIER"
},
{
"days": 180,
"storage_class": "DEEP_ARCHIVE"
}
]
no

Outputs

Name Description
arn The arn of the bucket.
id The id of the bucket.

Providers

Name Version
aws >= 4.40

Resources

  • resource.aws_s3_bucket.main (main.tf#19)
  • resource.aws_s3_bucket_lifecycle_configuration.main (main.tf#52)
  • resource.aws_s3_bucket_metric.main (main.tf#85)
  • resource.aws_s3_bucket_policy.main (main.tf#25)
  • resource.aws_s3_bucket_public_access_block.main (main.tf#31)
  • resource.aws_s3_bucket_server_side_encryption_configuration.main (main.tf#40)

Examples

Basic Example

module "basic-example" {
  source = "../../"
  name   = var.name
  policy = var.policy
}

with Transitions

module "with-transitions" {
  source = "../../"
  name   = "my-bucket-123"

  transitions = [
    {
      storage_class = "STANDARD_IA"
      days          = 90
    }
  ]
}