Skip to content

Commit

Permalink
fix: abort incomplete uploads to s3 bucket (#379) (#380)
Browse files Browse the repository at this point in the history
As a best practice to save costs there should be a lifecycle configuration on s3 buckets to abort incomplete uploads

https://docs.aws.amazon.com/AmazonS3/latest/userguide/mpu-abort-incomplete-mpu-lifecycle-config.html
  • Loading branch information
msvticket authored Sep 9, 2024
1 parent 09ca279 commit dbb7e35
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion modules/backup/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ resource "aws_s3_bucket_server_side_encryption_configuration" "backup_bucket" {

resource "aws_s3_bucket_lifecycle_configuration" "backup_bucket" {
count = var.enable_backup ? 1 : 0
bucket = aws_s3_bucket.backup_bucket.id
bucket = aws_s3_bucket.backup_bucket[0].id
rule {
status = "Enabled"
id = "abort_incomplete_uploads"
Expand Down
6 changes: 3 additions & 3 deletions modules/cluster/storage.tf
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ resource "aws_s3_bucket_server_side_encryption_configuration" "logs_jenkins_x" {

resource "aws_s3_bucket_lifecycle_configuration" "logs_jenkins_x" {
count = var.enable_logs_storage ? 1 : 0
bucket = aws_s3_bucket.logs_jenkins_x.id
bucket = aws_s3_bucket.logs_jenkins_x[0].id
rule {
status = "Enabled"
id = "abort_incomplete_uploads"
Expand Down Expand Up @@ -95,7 +95,7 @@ resource "aws_s3_bucket_server_side_encryption_configuration" "reports_jenkins_x

resource "aws_s3_bucket_lifecycle_configuration" "reports_jenkins_x" {
count = var.enable_reports_storage ? 1 : 0
bucket = aws_s3_bucket.reports_jenkins_x.id
bucket = aws_s3_bucket.reports_jenkins_x[0].id
rule {
status = "Enabled"
id = "abort_incomplete_uploads"
Expand Down Expand Up @@ -145,7 +145,7 @@ resource "aws_s3_bucket_server_side_encryption_configuration" "repository_jenkin

resource "aws_s3_bucket_lifecycle_configuration" "repository_jenkins_x" {
count = var.enable_repository_storage ? 1 : 0
bucket = aws_s3_bucket.repository_jenkins_x.id
bucket = aws_s3_bucket.repository_jenkins_x[0].id
rule {
status = "Enabled"
id = "abort_incomplete_uploads"
Expand Down

0 comments on commit dbb7e35

Please sign in to comment.