Skip to content

s3 bucket that you can turn on and off policy with lifecycle support

Notifications You must be signed in to change notification settings

ucopacme/terraform-aws-s3-multi-use-bucket

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

terraform-aws-s3

Terraform AWS S3 Module

-->

#
#

# make sure you deploy the security group before creating ec2 instance, ec2 instance depends on the security group.




data "aws_caller_identity" "current" {}

output "account_id" {
  value = data.aws_caller_identity.current.account_id
}

module "s3" {
  source                   = "git::https://[email protected]/ucopacme/terraform-aws-s3-multi-use-bucket.git//?ref=v0.0.4"
  bucket                   = join("-", ["server-access-logging", data.aws_caller_identity.current.account_id, "us-west-2"])
  enabled                  = true
  policy                   = file("./policy.json")
  policy_enabled           = false
  lifecycle_rule_enabled   = "Enabled"
  lifecycle_id             = "secops lifecycle"
  sse_algorithm            = "AES256"
  standard_transition_days = 30
  infrequent_access_type   = "STANDARD_IA"
  expiration_days          = 180
  prefix                   = "" # Default = "" ; to use:  prefix = "logs/"
  tags = {
    "ucop:application" = "security-logging"
    "ucop:createdBy"   = "terraform"
    "ucop:environment" = "prod"
    "ucop:group"       = "cs"
    "ucop:source"      = "https://github.com/ucopacme/ucop-terraform-config.git"
  }
  versioning_enabled = "Disabled"
}


2. (Optional) create outputs.tf config file, copy/paste the following configuration.

output "bucket_name" {
  value       = module.s3.bucket_name
  description = "Bucket Name"
}
output "bucket_id" {
  value       = module.s3.bucket_id
  description = "Bucket ID"
}
output "bucket_arn" {
  value       = module.s3.bucket_arn
  description = "Bucket ARN"
}
output "bucket_regional_name" {
  value       = module.s3.bucket_regional_name
  description = "The AWS CloudFront allows specifying S3 region-specific endpoint when creating S3 origin, it will prevent redirect issues from CloudFront to S3 Origin URL."
}
output "hosted_zone_id" {
  value       = module.s3.hosted_zone_id
  description = "The Route 53 Hosted Zone ID for this bucket's region."
}
output "website_endpoint" {
  value       = module.s3.website_endpoint
  description = "The website endpoint, if the bucket is configured with a website. If not, this will be an empty string."
}
output "website_domain" {
  value       = module.s3.website_domain
  description = "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."
}

About

s3 bucket that you can turn on and off policy with lifecycle support

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages