Skip to content

Commit

Permalink
Update main.tf
Browse files Browse the repository at this point in the history
  • Loading branch information
wullub committed Jun 6, 2023
1 parent 42f39c7 commit 9256df0
Showing 1 changed file with 60 additions and 60 deletions.
120 changes: 60 additions & 60 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,61 +6,61 @@ data "aws_vpc" "shared" {

# Terraform module which creates S3 Bucket resources for Load Balancer Access Logs on AWS.

module "s3-bucket" {
count = var.existing_bucket_name == "" ? 1 : 0
source = "github.com/ministryofjustice/modernisation-platform-terraform-s3-bucket?ref=v6.4.0"

providers = {
aws.bucket-replication = aws.bucket-replication
}
bucket_prefix = "${var.application_name}-lb-access-logs"
bucket_policy = [data.aws_iam_policy_document.bucket_policy.json]
replication_enabled = false
versioning_enabled = true
force_destroy = var.force_destroy_bucket
lifecycle_rule = [
{
id = "main"
enabled = "Enabled"
prefix = ""

tags = {
rule = "log"
autoclean = "true"
}

transition = [
{
days = 90
storage_class = "STANDARD_IA"
}, {
days = 365
storage_class = "GLACIER"
}
]

expiration = {
days = 730
}

noncurrent_version_transition = [
{
days = 90
storage_class = "STANDARD_IA"
}, {
days = 365
storage_class = "GLACIER"
}
]

noncurrent_version_expiration = {
days = 730
}
}
]

tags = var.tags
}
# module "s3-bucket" {
# count = var.existing_bucket_name == "" ? 1 : 0
# source = "github.com/ministryofjustice/modernisation-platform-terraform-s3-bucket?ref=v6.4.0"

# providers = {
# aws.bucket-replication = aws.bucket-replication
# }
# bucket_prefix = "${var.application_name}-lb-access-logs"
# bucket_policy = [data.aws_iam_policy_document.bucket_policy.json]
# replication_enabled = false
# versioning_enabled = true
# force_destroy = var.force_destroy_bucket
# lifecycle_rule = [
# {
# id = "main"
# enabled = "Enabled"
# prefix = ""

# tags = {
# rule = "log"
# autoclean = "true"
# }

# transition = [
# {
# days = 90
# storage_class = "STANDARD_IA"
# }, {
# days = 365
# storage_class = "GLACIER"
# }
# ]

# expiration = {
# days = 730
# }

# noncurrent_version_transition = [
# {
# days = 90
# storage_class = "STANDARD_IA"
# }, {
# days = 365
# storage_class = "GLACIER"
# }
# ]

# noncurrent_version_expiration = {
# days = 730
# }
# }
# ]

# tags = var.tags
# }

data "aws_iam_policy_document" "bucket_policy" {
statement {
Expand Down Expand Up @@ -131,11 +131,11 @@ resource "aws_lb" "loadbalancer" {
idle_timeout = var.idle_timeout
drop_invalid_header_fields = true

access_logs {
bucket = var.existing_bucket_name != "" ? var.existing_bucket_name : module.s3-bucket[0].bucket.id
prefix = var.application_name
enabled = true
}
# access_logs {
# bucket = var.existing_bucket_name != "" ? var.existing_bucket_name : module.s3-bucket[0].bucket.id
# prefix = var.application_name
# enabled = true
# }

tags = merge(
var.tags,
Expand Down

0 comments on commit 9256df0

Please sign in to comment.