Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable trailing delete in production #186

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that this month-old PR is still a draft, I would like right away to adjust policies here to exclude /zarr/ prefix from trailing delete functionality -- we do want to keep prior versionIds even after DeleteMarker is added.

What would that entail?

Ref:

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