Skip to content

Commit

Permalink
fix s3 permissions applied to the staffplan bot
Browse files Browse the repository at this point in the history
  • Loading branch information
fermion committed Oct 12, 2024
1 parent ed99d78 commit 9d12df5
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 22 deletions.
40 changes: 22 additions & 18 deletions tf/provider.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,24 +33,28 @@ resource "aws_iam_policy" "staffplan_redux_bot_policy" {
name = "staffplan_redux_bot_policy"
path = "/"
description = "S3 bucket policy for staffplan_redux_bot"

policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:PutObject",
"s3:GetObject",
"s3:DeleteObject",
"s3:ListBucket"
],
"Resource": "${aws_s3_bucket.staffplan_redux_production.arn}/*"
}
]
}
EOF
policy = jsonencode({
Version = "2012-10-17"
Statement = [
{
Effect = "Allow"
Action = [
"s3:PutObject",
"s3:GetObject",
"s3:DeleteObject",
]
Resource = "${aws_s3_bucket.staffplan_redux_production.arn}/*"
},
{
Effect = "Allow"
Action = [
"s3:ListBucket",
"s3:ListBucketMultipartUploads",
]
Resource = "${aws_s3_bucket.staffplan_redux_production.arn}"
}
]
})
}

resource "aws_iam_policy_attachment" "s3_policy_attachment" {
Expand Down
8 changes: 4 additions & 4 deletions tf/terraform.tfstate
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"version": 4,
"terraform_version": "1.5.7",
"serial": 37,
"terraform_version": "1.9.7",
"serial": 52,
"lineage": "6c680206-1f35-759f-49a7-8ad19bca3f72",
"outputs": {
"bucket_arn": {
Expand All @@ -25,8 +25,8 @@
"name": "staffplan_redux_bot_policy",
"name_prefix": "",
"path": "/",
"policy": "{\"Statement\":[{\"Action\":[\"s3:PutObject\",\"s3:GetObject\",\"s3:DeleteObject\",\"s3:ListBucket\"],\"Effect\":\"Allow\",\"Resource\":\"arn:aws:s3:::staffplan-redux-production/*\"}],\"Version\":\"2012-10-17\"}",
"policy_id": "ANPA5KYKEGZV7WPZAGHQT",
"policy": "{\"Statement\":[{\"Action\":[\"s3:PutObject\",\"s3:GetObject\",\"s3:DeleteObject\"],\"Effect\":\"Allow\",\"Resource\":\"arn:aws:s3:::staffplan-redux-production/*\"},{\"Action\":[\"s3:ListBucket\",\"s3:ListBucketMultipartUploads\"],\"Effect\":\"Allow\",\"Resource\":\"arn:aws:s3:::staffplan-redux-production\"}],\"Version\":\"2012-10-17\"}",
"policy_id": "ANPA5KYKEGZVS3JRXTADI",
"tags": {},
"tags_all": {}
},
Expand Down

0 comments on commit 9d12df5

Please sign in to comment.