Skip to content

Instantly share code, notes, and snippets.

@unbelauscht
Last active August 5, 2021 14:51
Show Gist options
  • Save unbelauscht/b5f18f1b0ec845d5e26f12ef3d574078 to your computer and use it in GitHub Desktop.
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
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