Skip to content

Commit 1425a79

Browse files
authored
Merge pull request #380 from jdno/cdn-logs-access
Grant crates.io access to CDN logs
2 parents 658b2c6 + 7ce8872 commit 1425a79

File tree

1 file changed

+26
-0
lines changed
  • terragrunt/modules/crates-io

1 file changed

+26
-0
lines changed

terragrunt/modules/crates-io/iam.tf

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,32 @@ resource "aws_iam_user_policy_attachment" "heroku_static_write" {
7070
policy_arn = aws_iam_policy.static_write.arn
7171
}
7272

73+
resource "aws_iam_policy" "cdn_logs_read" {
74+
name = "${var.iam_prefix}--cdn-logs-read"
75+
description = "Read access to the S3 bucket with CDN logs"
76+
77+
policy = jsonencode({
78+
Version = "2012-10-17"
79+
Statement = [
80+
{
81+
Sid = "CDNLogsRead"
82+
Effect = "Allow"
83+
Action = [
84+
"s3:GetObject",
85+
]
86+
Resource = [
87+
"${aws_s3_bucket.logs.arn}/*",
88+
]
89+
}
90+
]
91+
})
92+
}
93+
94+
resource "aws_iam_user_policy_attachment" "heroku_cdn_logs_read" {
95+
user = aws_iam_user.heroku.name
96+
policy_arn = aws_iam_policy.cdn_logs_read.arn
97+
}
98+
7399
resource "aws_iam_role" "s3_replication" {
74100
name = "${var.iam_prefix}--s3-replication"
75101

0 commit comments

Comments
 (0)