Skip to content

Instantly share code, notes, and snippets.

@theCaptN21
Created February 2, 2023 14:38
Show Gist options
  • Save theCaptN21/ad23fb81d599177d1aedde76a1794b7c to your computer and use it in GitHub Desktop.
Save theCaptN21/ad23fb81d599177d1aedde76a1794b7c to your computer and use it in GitHub Desktop.
#Jenkins Bucket Policy
resource "aws_iam_policy" "jenkins_s3_write_policy" {
name = "jenkins_s3_write_policy"
policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"s3:PutObject",
"s3:GetObject"
],
"Effect": "Allow",
"Resource": "${aws_s3_bucket.yourbucketname.arn}/*"
}
]
}
EOF
}
resource "aws_iam_role_policy_attachment" "jenkins_s3_write_attachment" {
policy_arn = aws_iam_policy.jenkins_s3_write_policy.arn
role = aws_iam_role.jenkins_role.name
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment