Skip to content

Commit

Permalink
Merge pull request #175 from dandi/embargoed-object-tags-2
Browse files Browse the repository at this point in the history
Add bucket policy statement for embargoed objects
  • Loading branch information
jjnesbitt authored Apr 3, 2024
2 parents 791ff4e + 6c4cad1 commit afb577d
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions terraform/modules/dandiset_bucket/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,33 @@ data "aws_iam_policy_document" "dandiset_bucket_policy" {
}
}

# Disallow access to embargoed objects, unless using the heroku user arn
dynamic "statement" {
for_each = var.public ? [1] : []

content {
effect = "Deny"
principals {
identifiers = ["*"]
type = "*"
}
actions = ["s3:*"]
resources = [
"${aws_s3_bucket.dandiset_bucket.arn}/*",
]
condition {
test = "StringEquals"
variable = "s3:ExistingObjectTag/embargoed"
values = ["true"]
}
condition {
test = "ArnNotEquals"
variable = "aws:PrincipalArn"
values = [var.heroku_user.arn]
}
}
}

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

Expand Down

0 comments on commit afb577d

Please sign in to comment.