Git Product home page Git Product logo

terraform-aws-s3's Introduction

Build Status

AWS S3 Terraform module

Description

This terraform module creates an S3 Bucket with the options of adding other s3 bucket configurations.

Examples available here

Usage

NOTE: These examples use the latest version of this module

locals {
  name = "minimum-example-bucket"
}

module "minimum" {
  source = "../../"
  bucket = local.name
  tags = {
    Name        = local.name
    Environment = "Dev"
  }
}
}

Documentation

AWS S3 Bucket documentation

Terraform provider documentation

Requirements

Name Version
terraform >= 0.14.11
aws >= 4.15.1

Providers

Name Version
aws 4.22.0

Modules

No modules.

Resources

Name Type
aws_s3_bucket.main resource
aws_s3_bucket_acl.main resource
aws_s3_bucket_cors_configuration.main resource
aws_s3_bucket_logging.main resource
aws_s3_bucket_policy.main resource
aws_s3_bucket_public_access_block.main resource
aws_s3_bucket_server_side_encryption_configuration.main resource
aws_s3_bucket_versioning.main resource

Inputs

Name Description Type Default Required
block_public_acls (Optional) Whether Amazon S3 should block public ACLs for this bucket. bool true no
block_public_policy (Optional) Whether Amazon S3 should block public bucket policies for this bucket. bool true no
bucket (Optional, Forces new resource) The name of the bucket. If omitted, Terraform will assign a random, unique name. Must be lowercase and less than or equal to 63 characters in length. string null no
bucket_acl The canned ACL to apply. any {} no
bucket_policy Attaches a policy to an S3 bucket resource. string null no
bucket_prefix Optional, Forces new resource) Creates a unique bucket name beginning with the specified prefix. Conflicts with bucket. Must be lowercase and less than or equal to 37 characters in length. string null no
cors_rule A rule of Cross-Origin Resource Sharing. any [] no
expected_bucket_owner (Optional, Forces new resource) The account ID of the expected bucket owner. string null no
force_destroy (Optional, Default:false) A boolean that indicates all objects (including any locked objects) should be deleted from the bucket so that the bucket can be destroyed without error. These objects are not recoverable. bool false no
ignore_public_acls (Optional) Whether Amazon S3 should ignore public ACLs for this bucket. bool true no
restrict_public_buckets (Optional) Whether Amazon S3 should restrict public bucket policies for this bucket. bool true no
s3_logging A map of configurations where to store logs map(any) {} no
sse_bucket_key_enabled (Optional) Whether or not to use Amazon S3 Bucket Keys for SSE-KMS. bool null no
sse_kms_master_key_arn (Optional) The AWS KMS master key ARN used for the SSE-KMS encryption. This can only be used when you set the value of sse_algorithm as aws:kms. The default aws/s3 AWS KMS master key is used if this element is absent while the sse_algorithm is aws:kms. string null no
sse_sse_algorithm (Required) The server-side encryption algorithm to use. Valid values are AES256 and aws:kms string "aws:kms" no
tags (Optional) A map of tags to assign to the bucket. map(string) {} no
versioning_mfa The concatenation of the authentication device's serial number, a space, and the value that is displayed on your authentication device. string null no
versioning_mfa_delete (Optional) Specifies whether MFA delete is enabled in the bucket versioning configuration. Valid values: Enabled or Disabled. string null no
versioning_status (Required) The versioning state of the bucket. Valid values: Enabled, Suspended, or Disabled. Disabled should only be used when creating or importing resources that correspond to unversioned S3 buckets. string "Enabled" no

Outputs

Name Description
arn The ARN of the bucket. Will be of format arn:aws:s3:::bucketname
bucket The name of the bucket.
bucket_domain_name The bucket domain name. Will be of format bucketname.s3.amazonaws.com.
bucket_regional_domain_name The bucket region-specific domain name. The bucket domain name including the region name
hosted_zone_id The Route 53 Hosted Zone ID for this bucket's region.
id The name of the bucket.
region The AWS region this bucket resides in.
tags_all A map of tags assigned to the resource, including those inherited from the provider default_tags
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.
website_endpoint The website endpoint, if the bucket is configured with a website. If not, this will be an empty string

Third party software

This repository uses third party software:

  • pre-commit - Used to help ensure code and documentation consistency
    • Install with brew install pre-commit
    • Manually use with pre-commit run
  • terraform 0.14.11 For backwards compatibility we are using version 0.14.11 for testing making this the min version tested and without issues with terraform-docs.
  • terraform-docs - Used to generate the Inputs and Outputs sections
    • Install with brew install terraform-docs
    • Manually use via pre-commit
  • tflint - Used to lint the Terraform code
    • Install with brew install tflint
    • Manually use via pre-commit

Makefile

The makefile contain in this repo is optimised for linux paths and the main purpose is to execute testing for now.

  • Create all tests: $ make tests
  • Clean all tests: $ make clean

BOLDLink-SIG 2022

terraform-aws-s3's People

Contributors

patrickmukumbu avatar ndegwajohn avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.