-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #413 from jdno/downloads-archive-s3
Create bucket to store downloads statistics
- Loading branch information
Showing
10 changed files
with
133 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,10 @@ | |
"regions": [ | ||
{ | ||
"region": "us-west-1" | ||
}, | ||
{ | ||
"region": "us-east-1", | ||
"alias": "us-east-1" | ||
} | ||
] | ||
} | ||
|
25 changes: 25 additions & 0 deletions
25
terragrunt/accounts/crates-io-prod/crates-io-downloads-archive/.terraform.lock.hcl
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
terragrunt/accounts/crates-io-prod/crates-io-downloads-archive/terragrunt.hcl
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
terraform { | ||
source = "../../../..//terragrunt/modules/crates-io-downloads-archive" | ||
} | ||
|
||
include { | ||
path = find_in_parent_folders() | ||
merge_strategy = "deep" | ||
} | ||
|
||
inputs = { | ||
downloads_archive_bucket_name = "crates-io-downloads-archive" | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
e081d07d9a9d2b6ae8db617275d0b626292ce5dc | ||
555f7ecaaf8662f018b35ec81681cf0260bdb04f |
25 changes: 25 additions & 0 deletions
25
terragrunt/accounts/crates-io-staging/crates-io-downloads-archive/.terraform.lock.hcl
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
terragrunt/accounts/crates-io-staging/crates-io-downloads-archive/terragrunt.hcl
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
terraform { | ||
source = "../../../..//terragrunt/modules/crates-io-downloads-archive" | ||
} | ||
|
||
include { | ||
path = find_in_parent_folders() | ||
merge_strategy = "deep" | ||
} | ||
|
||
inputs = { | ||
downloads_archive_bucket_name = "staging-crates-io-downloads-archive" | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Archived Download Statistics for crates.io | ||
|
||
This module creates the infrastructure that is used to archive download | ||
statistics from [crates.io] for longer than 90 days. Currently, that is a single | ||
S3 bucket that stores CSV files with daily download counts. A new bucket has | ||
been created for this purpose, as the existing buckets for [crates.io] are | ||
publicly accessible. | ||
|
||
See [rust-lang/crates.io#3479] for details. | ||
|
||
[crates.io]: https://crates.io | ||
[rust-lang/crates.io#3479]: https://github.com/rust-lang/crates.io/issues/3479 |
10 changes: 10 additions & 0 deletions
10
terragrunt/modules/crates-io-downloads-archive/_terraform.tf
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
terraform { | ||
required_version = "~> 1" | ||
|
||
required_providers { | ||
aws = { | ||
source = "hashicorp/aws" | ||
version = "~> 4.32" | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
resource "aws_s3_bucket" "downloads_archive" { | ||
provider = aws.us-east-1 | ||
|
||
bucket = var.downloads_archive_bucket_name | ||
} | ||
|
||
data "aws_iam_user" "heroku_access" { | ||
user_name = "crates-io-heroku-access" | ||
} | ||
|
||
resource "aws_iam_user_policy" "downloads_archive_write" { | ||
name = "downloads-archive-write" | ||
user = data.aws_iam_user.heroku_access.user_name | ||
policy = data.aws_iam_policy_document.downloads_archive_write.json | ||
} | ||
|
||
data "aws_iam_policy_document" "downloads_archive_write" { | ||
statement { | ||
sid = "WriteToDownloadsArchive" | ||
effect = "Allow" | ||
|
||
actions = [ | ||
"s3:PutObject", | ||
] | ||
|
||
resources = ["${aws_s3_bucket.downloads_archive.arn}/*"] | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
variable "downloads_archive_bucket_name" { | ||
description = "The name of the S3 bucket to store the downloads archive" | ||
type = string | ||
} |