Last active
August 5, 2021 14:51
-
-
Save unbelauscht/b5f18f1b0ec845d5e26f12ef3d574078 to your computer and use it in GitHub Desktop.
Simple allow all s3 access to specified bucket for IAM user terraform code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "aws_iam_user_policy" "bucket_access" { | |
name = "bucket_access" | |
user = aws_iam_user.bucket_user.name | |
policy = <<EOF | |
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Sid": "terraform0", | |
"Effect": "Allow", | |
"Action": "s3:ListBucket", | |
"Resource": [ | |
"${aws_s3_bucket.bucket.arn}*", | |
] | |
}, | |
{ | |
"Sid": "terraform1", | |
"Effect": "Allow", | |
"Action": [ | |
"s3:PutObject", | |
"s3:GetObjectAcl", | |
"s3:GetObject", | |
"s3:DeleteObject", | |
"s3:PutObjectAcl" | |
], | |
"Resource": [ | |
"${aws_s3_bucket.bucket.arn}*" | |
] | |
} | |
] | |
} | |
EOF | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment