Skip to content

Commit

Permalink
Set retention period for backend checks result S3 bucket
Browse files Browse the repository at this point in the history
The s3 bucket contains state information about the backend checks for a consignment whilst the checks are running

The data is transitory and does not need to be retained after completion of the checks
  • Loading branch information
TomJKing committed Jan 21, 2025
1 parent f83728d commit 53e177f
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions root_s3_object_lifecycle.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
locals {
default_expiration_days = local.environment == "prod" ? 30 : 7
backend_checks_bucket_policy_status = local.environment == "intg" ? "Enabled" : "Disabled"
}

resource "aws_s3_bucket_lifecycle_configuration" "backend_checks_results_s3_bucket" {
bucket = module.backend_lambda_function_bucket.s3_bucket_id
rule {
id = "delete-backend-checks-results-bucket-objects"
status = local.backend_checks_bucket_policy_status
expiration {
days = local.default_expiration_days
}
}
}

0 comments on commit 53e177f

Please sign in to comment.