Skip to content

Commit

Permalink
Enable trailing delete in production
Browse files Browse the repository at this point in the history
  • Loading branch information
mvandenburgh committed Sep 9, 2024
1 parent b547159 commit 9cd08b4
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 13 deletions.
4 changes: 2 additions & 2 deletions terraform/modules/dandiset_bucket/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ data "aws_iam_policy_document" "dandiset_bucket_policy" {
}

dynamic "statement" {
for_each = var.trailing_delete ? [1] : []
for_each = var.versioning ? [1] : []

content {
sid = "PreventDeletionOfObjectVersions"
Expand Down Expand Up @@ -313,7 +313,7 @@ resource "aws_s3_bucket_lifecycle_configuration" "expire_deleted_objects" {
# Must have bucket versioning enabled first
depends_on = [aws_s3_bucket_versioning.dandiset_bucket]

count = var.trailing_delete ? 1 : 0
count = var.versioning ? 1 : 0

bucket = aws_s3_bucket.dandiset_bucket.id

Expand Down
7 changes: 0 additions & 7 deletions terraform/modules/dandiset_bucket/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,3 @@ variable "log_bucket_name" {
type = string
description = "The name of the log bucket."
}

# TODO: this can be inferred from the "versioning" variable once we're ready
# to deploy this to the production bucket as well.
variable "trailing_delete" {
type = bool
description = "Whether or not trailing delete should be enabled on the bucket."
}
2 changes: 0 additions & 2 deletions terraform/sponsored_bucket.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ module "sponsored_dandiset_bucket" {
bucket_name = "dandiarchive"
public = true
versioning = true
trailing_delete = false
allow_cross_account_heroku_put_object = true
heroku_user = data.aws_iam_user.api
log_bucket_name = "dandiarchive-logs"
Expand All @@ -17,7 +16,6 @@ module "sponsored_embargo_bucket" {
source = "./modules/dandiset_bucket"
bucket_name = "dandiarchive-embargo"
versioning = false
trailing_delete = false
heroku_user = data.aws_iam_user.api
log_bucket_name = "dandiarchive-embargo-logs"
providers = {
Expand Down
2 changes: 0 additions & 2 deletions terraform/staging_bucket.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ module "staging_dandiset_bucket" {
bucket_name = "dandi-api-staging-dandisets"
public = true
versioning = true
trailing_delete = true
allow_heroku_put_object = true
heroku_user = data.aws_iam_user.api_staging
log_bucket_name = "dandi-api-staging-dandiset-logs"
Expand All @@ -17,7 +16,6 @@ module "staging_embargo_bucket" {
source = "./modules/dandiset_bucket"
bucket_name = "dandi-api-staging-embargo-dandisets"
versioning = false
trailing_delete = false
heroku_user = data.aws_iam_user.api_staging
log_bucket_name = "dandi-api-staging-embargo-dandisets-logs"
providers = {
Expand Down

0 comments on commit 9cd08b4

Please sign in to comment.