Skip to content

Commit

Permalink
Merge pull request #190 from dandi/scoped-lifecycle-policy
Browse files Browse the repository at this point in the history
Scope trailing delete policy to `blobs` prefix only
  • Loading branch information
mvandenburgh authored Oct 28, 2024
2 parents 7e2bd38 + 64fb493 commit 7937110
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions terraform/modules/dandiset_bucket/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ data "aws_iam_policy_document" "dandiset_bucket_policy" {


# S3 lifecycle policy that permanently deletes objects with delete markers
# after 30 days.
# after 30 days. Note, this only applies to objects with the `blobs/` prefix.
resource "aws_s3_bucket_lifecycle_configuration" "expire_deleted_objects" {
# Must have bucket versioning enabled first
depends_on = [aws_s3_bucket_versioning.dandiset_bucket]
Expand All @@ -320,7 +320,11 @@ resource "aws_s3_bucket_lifecycle_configuration" "expire_deleted_objects" {
# Based on https://docs.aws.amazon.com/AmazonS3/latest/userguide/lifecycle-configuration-examples.html#lifecycle-config-conceptual-ex7
rule {
id = "ExpireOldDeleteMarkers"
filter {}
filter {
# We only want to expire objects with the `blobs/` prefix, i.e. Asset Blobs.
# Other objects in this bucket are not subject to this lifecycle policy.
prefix = "blobs/"
}

# Expire objects with delete markers after 30 days
noncurrent_version_expiration {
Expand Down

0 comments on commit 7937110

Please sign in to comment.