Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
psychomantys committed Apr 24, 2024
1 parent 907fc50 commit 75db5bb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions _data.tf
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,5 @@ data "aws_iam_policy_document" "allow_read_write" {
]
}
}

data "aws_canonical_user_id" "current" {}
6 changes: 3 additions & 3 deletions acl.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ resource "aws_s3_bucket_ownership_controls" "bucket_acl" {
count = var.create && var.create_iam_user && var.create_iam_user_write_acl ? 1 : 0
bucket = aws_s3_bucket.bucket[0].id
rule {
object_ownership = "BucketOwnerPreferred"
object_ownership = "ObjectWriter"
}
}

Expand All @@ -17,7 +17,7 @@ resource "aws_s3_bucket_acl" "grant_owner_to_iam" {
access_control_policy {
grant {
grantee {
id = aws_iam_user.bucket_user[0].arn
id = data.aws_canonical_user_id.current.id
type = "CanonicalUser"
}
permission = "WRITE_ACP"
Expand All @@ -32,7 +32,7 @@ resource "aws_s3_bucket_acl" "grant_owner_to_iam" {
}

owner {
id = aws_iam_user.bucket_user[0].arn
id = data.aws_canonical_user_id.current.id
}
}
}

0 comments on commit 75db5bb

Please sign in to comment.