From 4a06c5e7560b08741e57890b068f14a8320d33e7 Mon Sep 17 00:00:00 2001 From: Andrew Pearce Date: Tue, 17 Sep 2024 12:47:37 +0100 Subject: [PATCH] consolidate and update lifecycles --- terraform/account/region/s3_lb_access_logs.tf | 37 +++++-------------- 1 file changed, 10 insertions(+), 27 deletions(-) diff --git a/terraform/account/region/s3_lb_access_logs.tf b/terraform/account/region/s3_lb_access_logs.tf index bff448b4f8..fad878a687 100644 --- a/terraform/account/region/s3_lb_access_logs.tf +++ b/terraform/account/region/s3_lb_access_logs.tf @@ -52,8 +52,16 @@ resource "aws_s3_bucket_lifecycle_configuration" "lifecycle" { bucket = aws_s3_bucket.access_log.id rule { - id = "retain-for-400-days" + id = "retain-logs-for-13-months" status = "Enabled" + transition { + days = 30 + storage_class = "STANDARD_IA" + } + transition { + days = 60 + storage_class = "GLACIER" + } expiration { days = 400 } @@ -61,13 +69,13 @@ resource "aws_s3_bucket_lifecycle_configuration" "lifecycle" { noncurrent_days = 400 } } + rule { id = "abort-incomplete-multipart-upload" status = "Enabled" abort_incomplete_multipart_upload { days_after_initiation = 7 } - } } @@ -169,31 +177,6 @@ resource "aws_s3_bucket_public_access_block" "access_log" { restrict_public_buckets = true } -resource "aws_s3_bucket_lifecycle_configuration" "log_retention_policy" { - provider = aws.region - bucket = aws_s3_bucket.access_log.id - - rule { - id = "retain-logs-for-13-months" - status = "Enabled" - - transition { - days = 30 - storage_class = "STANDARD_IA" - } - - transition { - days = 60 - storage_class = "GLACIER" - } - - expiration { - days = 400 - } - - } -} - data "aws_iam_role" "sns_success_feedback" { name = "SNSSuccessFeedback" provider = aws.global