Skip to content

Commit

Permalink
Merge pull request #650 from rust-lang/chore-ci-staging-add-github-ac…
Browse files Browse the repository at this point in the history
…tions-ci-role

chore(ci-staging): add github actions ci role
  • Loading branch information
MarcoIeni authored Dec 13, 2024
2 parents f70eade + cc18242 commit d8c051b
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions terragrunt/modules/ci-runners/gh_oidc.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,31 @@ resource "aws_iam_openid_connect_provider" "github_actions_provider" {
// unused
thumbprint_list = ["1c58a3a8518e8759bf075b76b750d4f2df264fcd"]
}

resource "aws_iam_role" "github_actions_ci_role" {
name = "ci--rust-lang--aws-runners-test"
assume_role_policy = jsonencode({
Version = "2012-10-17"
Statement = [
{
Effect = "Allow"
Action = [
"sts:AssumeRoleWithWebIdentity",
]
Principal = {
Federated = aws_iam_openid_connect_provider.github_actions_provider.arn
}
Condition = {
// StringLike is used with a wildcard operator (*) to allow any branch, pull request merge branch
// of the repository to assume a role in AWS
StringLike : {
"token.actions.githubusercontent.com:sub" : "repo:rust-lang/aws-runners-test:ref:*"
},
StringEquals : {
"token.actions.githubusercontent.com:aud" : "sts.amazonaws.com"
}
}
}
]
})
}

0 comments on commit d8c051b

Please sign in to comment.