Skip to content

appzen-oss/terraform-aws-s3-buckets

 
 

Repository files navigation

AWS S3 Buckets Terraform module

CircleCI Github release

Terraform module which creates multiple AWS S3 buckets

Terraform Registry

Usage

module "s3-buckets" {
  source       = "devops-workflow/s3-buckets/aws"
  names        = ["bucket1", "bucket2", "bucket3"]
  environment  = "dev"
  organization = "corp"
}

This would create/manage 3 S3 buckets: corp-dev-bucket1, corp-dev-bucket2, and corp-dev-bucket3

If a S3 bucket already exists, you will need to import it. Like this:

terraform import module.s3-buckets.aws_s3_bucket.this[0] corp-dev-bucket1

Inputs

Name Description Type Default Required
allow_encrypted_uploads_only Set to true to prevent uploads of unencrypted objects to S3 bucket string false no
attributes Suffix name with additional attributes (policy, role, etc.) list <list> no
block_public_acls Whether Amazon S3 should block public ACLs for this bucket string "true" no
block_public_policy Whether Amazon S3 should block public bucket policies for this bucket string "true" no
component TAG: Underlying, dedicated piece of service (Cache, DB, ...) string "UNDEF-S3-Buckets" no
delimiter Delimiter to be used between name, namespaces, attributes, etc. string "-" no
enabled Set to false to prevent the module from creating anything string "true" no
environment Environment (ex: dev, qa, stage, prod). (Second or top level namespace. Depending on namespacing options) string n/a yes
encryption If encryption is true, create an S3 bucket with default encryption i.e. AES256 string false no
force_destroy Delete all objects in bucket on destroy string "false" no
ignore_public_acls Whether Amazon S3 should ignore public ACLs for this bucket string "true" no
kms_master_key_arn The AWS KMS master key ARN used for the SSE-KMS encryption. This can only be used when you set the value of encryption as true. The default aws/s3 AWS KMS master key is used if this element is absent string `` no
monitor TAG: Should resource be monitored string "UNDEF-S3-Buckets" no
names List of S3 bucket names list n/a yes
namespace-env Prefix name with the environment. If true, format is: - string "true" no
namespace-org Prefix name with the organization. If true, format is: -. If both env and org namespaces are used, format will be -- string "true" no
organization Organization name (Top level namespace) string "" no
owner TAG: Owner of the service string "UNDEF-S3-Buckets" no
principal principal string "*" no
product TAG: Company/business product string "UNDEF-S3-Buckets" no
public Allow public read access to bucket string "false" no
restrict_public_buckets Whether Amazon S3 should restrict public bucket policies for this bucket string "true" no
service TAG: Application (microservice) name string "UNDEF-S3-Buckets" no
sse_algorithm The server-side encryption algorithm to use. Valid values are AES256 and aws:kms string AES256 no
tags A map of additional tags map <map> no
team TAG: Department/team of people responsible for service string "UNDEF-S3-Buckets" no
versioned Version the bucket string "false" no

Outputs

Name Description
arns List of AWS S3 Bucket ARNs
domain_names List of AWS S3 Bucket Domain Names
hosted_zone_ids List of AWS S3 Bucket Hosted Zone IDs
ids List of AWS S3 Bucket IDs
name_bases List of base names used to generate S3 bucket names
names List of AWS S3 Bucket Names
regions List of AWS S3 Bucket Regions

Resource Graph of plan

Terraform Graph