Skip to content

Commit 93c2dd5

Browse files
committed
Renamed roles to iam and imported github openid
1 parent b4ea97c commit 93c2dd5

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

infra/roles.tf renamed to infra/iam.tf

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,22 @@ resource "aws_iam_role" "auto_ops" {
5959
AWS = "arn:aws:iam::${var.build_agent_account_id}:role/build-agent"
6060
},
6161
Action = "sts:AssumeRole"
62+
},
63+
{
64+
Sid = "",
65+
Effect = "Allow",
66+
Principal = {
67+
Federated = "arn:aws:iam::${var.imms_account_id}:oidc-provider/token.actions.githubusercontent.com"
68+
},
69+
Action = "sts:AssumeRoleWithWebIdentity",
70+
Condition = {
71+
StringEquals = {
72+
"token.actions.githubusercontent.com:aud" : "sts.amazonaws.com"
73+
},
74+
StringLike = {
75+
"token.actions.githubusercontent.com:sub" : "repo:NHSDigital/immunisation-fhir-api:*"
76+
}
77+
}
6278
}
6379
]
6480
})
@@ -78,3 +94,15 @@ resource "aws_iam_role_policy_attachment" "custom_auto_ops" {
7894
role = aws_iam_role.auto_ops.name
7995
policy_arn = aws_iam_policy.auto_ops.arn
8096
}
97+
98+
resource "aws_iam_openid_connect_provider" "github" {
99+
url = "https://token.actions.githubusercontent.com"
100+
101+
client_id_list = [
102+
"sts.amazonaws.com"
103+
]
104+
105+
thumbprint_list = [
106+
"2b18947a6a9fc7764fd8b5fb18a863b0c6dac24f"
107+
]
108+
}

0 commit comments

Comments
 (0)