Skip to content

Commit

Permalink
Merge pull request #428 from jdno/rustup-builds
Browse files Browse the repository at this point in the history
Create S3 bucket for Rustup build artifacts
  • Loading branch information
jdno authored Jul 1, 2024
2 parents 835f4b7 + 68b75d9 commit ae202dc
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 0 deletions.
25 changes: 25 additions & 0 deletions terragrunt/accounts/legacy/rustup-prod/rustup/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions terragrunt/accounts/legacy/rustup-prod/rustup/terragrunt.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
terraform {
source = "../../../../..//terragrunt/modules/rustup"
}

include {
path = find_in_parent_folders()
merge_strategy = "deep"
}
11 changes: 11 additions & 0 deletions terragrunt/modules/rustup/_terraform.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
terraform {
required_version = "~> 1.0"

required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 4.20"
}
}
}

34 changes: 34 additions & 0 deletions terragrunt/modules/rustup/s3.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# The rust-lang/rustup repository on GitHub builds and uploads Rustup artifacts
# to this S3 bucket.
resource "aws_s3_bucket" "builds" {
provider = aws.us-east-1

bucket = "rustup-builds"
}

module "ci_role" {
source = "../gha-oidc-role"
org = "rust-lang"
repo = "rustup"
branch = "master"
}

resource "aws_iam_policy" "upload_builds" {
name = "upload-rustup-builds"
policy = jsonencode({
Version = "2012-10-17"
Statement = [
{
Sid = "WriteToRustupBuilds"
Effect = "Allow"
Action = ["s3:PutObject"]
Resource = ["${aws_s3_bucket.builds.arn}/*"]
}
]
})
}

resource "aws_iam_role_policy_attachment" "ci_upload_builds" {
role = module.ci_role.role.id
policy_arn = aws_iam_policy.upload_builds.arn
}

0 comments on commit ae202dc

Please sign in to comment.