From 0aa7acf05a7ab228ce2302e36ef41d6432e3bfe3 Mon Sep 17 00:00:00 2001 From: Szymon Piechowicz Date: Fri, 10 Nov 2023 14:00:02 -0800 Subject: [PATCH] feat: Bucket versioning --- modules/file_storage/main.tf | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/modules/file_storage/main.tf b/modules/file_storage/main.tf index 39ced492..ee3a1afa 100644 --- a/modules/file_storage/main.tf +++ b/modules/file_storage/main.tf @@ -67,7 +67,24 @@ resource "aws_s3_bucket_server_side_encryption_configuration" "file_storage" { } } +resource "aws_s3_bucket_versioning" "file_storage" { + bucket = aws_s3_bucket.file_storage.id + versioning_configuration { + status = "Enabled" + } +} +resource "aws_s3_bucket_configuration" "file_storage" { + depends_on = [aws_s3_bucket_versioning.file_storage] + bucket = aws_s3_bucket.file_storage.id + rule { + id = "noncurrent-version-expiration" + status = "Enabled" + noncurrent_version_expiration = { + noncurrent_days = 30 + } + } +} # Give the bucket permission to send messages onto the queue. Looks like we