Skip to content

Terraform module for creating an S3 bucket to be used for logs

License

Notifications You must be signed in to change notification settings

MagnetarIT/terraform-aws-s3-logs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

terraform-aws-s3-logs

Terraform (>= 0.12.0) module to create an S3 bucket to be used for logs

Build Status Latest Release


Example

provider "aws" {
  region = "eu-west-2"
}

module "s3" {
  source      = "git::https://github.com/MagnetarIT/terraform-aws-s3-logs.git?ref=tags/0.1.0"
  namespace   = "mag"
  environment = "test"
  name        = "app"
  attributes  = ["alb-logs"]
}


Intro

This module will create the following resources

  • S3 bucket

Providers

Name Version
aws ~> 2.0

Inputs

Name Description Type Default Required
acl The canned ACL to apply. We recommend log-delivery-write for compatibility with AWS services string "log-delivery-write" no
attributes Additional attributes (e.g. 1) list(string) [] no
block_public_acls Set to false to disable the blocking of new public access lists on the bucket bool true no
block_public_policy Set to false to disable the blocking of new public policies on the bucket bool true no
enable_glacier_transition Enables the transition to AWS Glacier which can cause unnecessary costs for huge amount of small files bool true no
environment Environment, e.g. 'prod', 'staging', 'dev', 'pre-prod', 'UAT' string n/a yes
expiration_days Number of days after which to expunge the objects number 90 no
force_destroy (Optional, Default:false ) A boolean that indicates all objects should be deleted from the bucket so that the bucket can be destroyed without error. These objects are not recoverable bool false no
glacier_transition_days Number of days after which to move the data to the glacier storage tier number 60 no
ignore_public_acls Set to false to disable the ignoring of public access lists on the bucket bool 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 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 "" no
lifecycle_prefix Prefix filter. Used to manage object lifecycle events string "" no
lifecycle_rule_enabled Enable lifecycle events on this bucket bool true no
lifecycle_tags Tags filter. Used to manage object lifecycle events map(string) {} no
name Solution name, e.g. 'app' or 'jenkins' string n/a yes
namespace Namespace, which could be your team, business name or abbreviation, e.g. 'mag' or 'tar' string n/a yes
noncurrent_version_expiration_days Specifies when noncurrent object versions expire number 90 no
noncurrent_version_transition_days Specifies when noncurrent object versions transitions number 30 no
policy A valid bucket policy JSON document. Note that if the policy document is not specific enough (but still valid), Terraform may view the policy as constantly changing in a terraform plan. In this case, please make sure you use the verbose/specific version of the policy string "" no
region If specified, the AWS region this bucket should reside in. Otherwise, the region used by the callee string "" no
restrict_public_buckets Set to false to disable the restricting of making the bucket public bool true no
sse_algorithm The server-side encryption algorithm to use. Valid values are AES256 and aws:kms string "AES256" no
standard_transition_days Number of days to persist in the standard storage tier before moving to the infrequent access tier number 30 no
tags Additional tags (e.g. map('BusinessUnit','XYZ') map(string) {} no
versioning_enabled A state of versioning. Versioning is a means of keeping multiple variants of an object in the same bucket bool false no

Outputs

Name Description
bucket_arn Bucket ARN
bucket_domain_name FQDN of bucket
bucket_id Bucket Name (aka ID)
prefix Prefix configured for lifecycle rules

Support

Reach out to me at one of the following places!


License

License

See LICENSE for full details.

Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

  https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.