Skip to content

Commit af3c14b

Browse files
committed
Grant crates.io team read access to CDN logs
The crates.io team might need to access the CDN logs to debug the feature that counts crate downloads.
1 parent 658b2c6 commit af3c14b

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

terraform/team-members-access/.terraform.lock.hcl

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

terraform/team-members-access/crates-io.tf

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ data "aws_s3_bucket" "crates_io_buckets" {
2020
bucket = each.value
2121
}
2222

23+
data "aws_s3_bucket" "crates_io_log_buckets" {
24+
for_each = toset(["rust-crates-io-logs", "rust-staging-crates-io-logs"])
25+
bucket = each.value
26+
}
27+
2328
resource "aws_iam_group_policy" "crates_io" {
2429
group = aws_iam_group.crates_io.name
2530
name = "prod-access"
@@ -90,6 +95,27 @@ resource "aws_iam_group_policy" "crates_io" {
9095
Resource = [for _, bucket in data.aws_s3_bucket.crates_io_buckets : "${bucket.arn}/*"]
9196
},
9297

98+
// CDN log access
99+
//
100+
// The logs from CloudFront and Fastly are stored in an S3 bucket. Since those logs
101+
// are used to count crate downloads, team members might need to access them for
102+
// debugging purposes. Compared to the other buckets that the team has access to, the
103+
// log buckets are read-only.
104+
{
105+
Effect = "Allow"
106+
Action = "s3:ListBucket"
107+
Resource = [for _, bucket in data.aws_s3_bucket.crates_io_log_buckets : bucket.arn]
108+
},
109+
{
110+
Effect = "Allow"
111+
Action = [
112+
"s3:GetObject",
113+
"s3:GetObjectAcl",
114+
"s3:ListObjectsV2",
115+
]
116+
Resource = [for _, bucket in data.aws_s3_bucket.crates_io_log_buckets : "${bucket.arn}/*"]
117+
},
118+
93119
// Support access
94120
//
95121
// The following rules allow crates-io team members to reach out to AWS

0 commit comments

Comments
 (0)