File tree Expand file tree Collapse file tree
infrastructure/stacks/iams-developer-roles Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -721,6 +721,34 @@ data "aws_iam_policy_document" "github_actions_assume_role" {
721721 }
722722}
723723
724+ # Assume role policy document for GitHub Actions
725+ data "aws_iam_policy_document" "regression_repo_assume_role" {
726+ statement {
727+ sid = " OidcAssumeRoleWithWebIdentity"
728+ effect = " Allow"
729+ actions = [" sts:AssumeRoleWithWebIdentity" ]
730+
731+ principals {
732+ type = " Federated"
733+ identifiers = [
734+ aws_iam_openid_connect_provider . github . arn
735+ ]
736+ }
737+
738+ condition {
739+ test = " StringLike"
740+ variable = " token.actions.githubusercontent.com:sub"
741+ values = [" repo:${ var . github_org } /${ var . regression_repo } :*" ]
742+ }
743+
744+ condition {
745+ test = " StringEquals"
746+ variable = " token.actions.githubusercontent.com:aud"
747+ values = [" sts.amazonaws.com" ]
748+ }
749+ }
750+ }
751+
724752resource "aws_iam_policy" "stream_management" {
725753 name = " stream-management"
726754 description = " Allow GitHub Actions to manage project Firehose delivery streams and Kinesis streams"
Original file line number Diff line number Diff line change @@ -107,3 +107,20 @@ data "aws_iam_policy_document" "github_actions_iam_bootstrap_assume_role" {
107107 }
108108 }
109109}
110+
111+ resource "aws_iam_role" "regression_test_role" {
112+ name = " Eligibility-Signposting-API-E2E-Regression-Tests"
113+ description = " Role for regression testing"
114+ permissions_boundary = aws_iam_policy. permissions_boundary . arn
115+ path = " /service-roles/"
116+
117+ # Trust policy allowing GitHub Actions to assume the role
118+ assume_role_policy = data. aws_iam_policy_document . regression_repo_assume_role . json
119+
120+ tags = merge (
121+ local. tags ,
122+ {
123+ Name = " Eligibility-Signposting-API-E2E-Regression-Tests"
124+ }
125+ )
126+ }
Original file line number Diff line number Diff line change @@ -9,3 +9,9 @@ variable "github_repo" {
99 description = " GitHub repository"
1010 type = string
1111}
12+
13+ variable "regression_repo" {
14+ default = " eligibility-signposting-api-regression-tests"
15+ description = " GitHub repository"
16+ type = string
17+ }
You can’t perform that action at this time.
0 commit comments