Skip to content

Commit 689debe

Browse files
authored
Merge branch 'main' into PRM-741
2 parents 62ad50f + 402ef37 commit 689debe

18 files changed

Lines changed: 1036 additions & 16900 deletions

.github/workflows/deploy-prod.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- name: Checkout
2525
uses: actions/checkout@v6
2626
with:
27-
ref: refs/tags/${{ github.event.inputs.git_tag}}
27+
ref: refs/tags/${{ github.event.inputs.git_tag }}
2828
fetch-depth: "0"
2929

3030
- name: Apply base_iam
@@ -48,7 +48,7 @@ jobs:
4848
- name: Checkout Tag
4949
uses: actions/checkout@v6
5050
with:
51-
ref: refs/tags/${{ inputs.git_tag}}
51+
ref: refs/tags/${{ inputs.git_tag }}
5252
fetch-depth: "0"
5353

5454
- name: Apply Main

.github/workflows/deploy-sandbox.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ jobs:
9696
uses: ./.github/actions/tf-plan-apply
9797
with:
9898
# use newly created role
99-
aws_assume_role: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/${{ inputs.sandbox_name}}-github-actions-role
99+
aws_assume_role: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/${{ inputs.sandbox_name }}-github-actions-role
100100
bucket_prefix: "dev"
101101
aws_account_id: ${{ secrets.AWS_ACCOUNT_ID }}
102102
aws_region: ${{ vars.AWS_REGION }}
@@ -120,7 +120,7 @@ jobs:
120120
uses: ./.github/actions/tf-plan-apply
121121
with:
122122
# use newly created role
123-
aws_assume_role: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/${{ inputs.sandbox_name}}-github-actions-role
123+
aws_assume_role: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/${{ inputs.sandbox_name }}-github-actions-role
124124
bucket_prefix: "dev"
125125
aws_account_id: ${{ secrets.AWS_ACCOUNT_ID }}
126126
aws_region: ${{ vars.AWS_REGION }}

.github/workflows/deploy-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- name: Checkout branch
2525
uses: actions/checkout@v6
2626
with:
27-
ref: ${{ inputs.git_ref}}
27+
ref: ${{ inputs.git_ref }}
2828

2929
- name: Apply base_iam
3030
uses: ./.github/actions/tf-plan-apply
@@ -47,7 +47,7 @@ jobs:
4747
- name: Checkout main
4848
uses: actions/checkout@v6
4949
with:
50-
ref: ${{ github.event.inputs.git_ref}}
50+
ref: ${{ github.event.inputs.git_ref }}
5151

5252
- name: Apply Main
5353
uses: ./.github/actions/tf-plan-apply
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
resource "aws_iam_role" "github_actions" {
2+
name = "${terraform.workspace}-github-actions-role"
3+
description = "This role provides access for GitHub Actions to the ${terraform.workspace} environment. "
4+
force_detach_policies = false
5+
max_session_duration = 3600
6+
name_prefix = null
7+
path = "/"
8+
permissions_boundary = null
9+
tags = {}
10+
assume_role_policy = local.is_sandbox_or_dev ? jsonencode(
11+
{
12+
Statement = [
13+
{
14+
Action = "sts:AssumeRoleWithWebIdentity"
15+
Condition = {
16+
StringEquals = {
17+
"token.actions.githubusercontent.com:aud" = "sts.amazonaws.com"
18+
}
19+
StringLike = {
20+
"token.actions.githubusercontent.com:sub" = [
21+
"repo:NHSDigital/national-document-repository-infrastructure:*",
22+
"repo:NHSDigital/national-document-repository:*",
23+
]
24+
}
25+
}
26+
Effect = "Allow"
27+
Principal = {
28+
Federated = "arn:aws:iam::${data.aws_caller_identity.current.account_id}:oidc-provider/token.actions.githubusercontent.com"
29+
}
30+
},
31+
{
32+
Action = "sts:AssumeRole"
33+
Effect = "Allow"
34+
Principal = {
35+
AWS = "arn:aws:iam::${data.aws_caller_identity.current.account_id}:role/aws-reserved/sso.amazonaws.com/eu-west-2/AWSReservedSSO_DomainCGpit-Administrators_e00623801cb4b59e"
36+
}
37+
},
38+
]
39+
Version = "2012-10-17"
40+
}
41+
) : jsonencode(
42+
{
43+
Statement = [
44+
{
45+
Action = "sts:AssumeRoleWithWebIdentity"
46+
Condition = {
47+
StringEquals = {
48+
"token.actions.githubusercontent.com:aud" = "sts.amazonaws.com"
49+
}
50+
StringLike = {
51+
"token.actions.githubusercontent.com:sub" = [
52+
"repo:NHSDigital/national-document-repository-infrastructure:*",
53+
"repo:NHSDigital/national-document-repository:*",
54+
]
55+
}
56+
}
57+
Effect = "Allow"
58+
Principal = {
59+
Federated = "arn:aws:iam::${data.aws_caller_identity.current.account_id}:oidc-provider/token.actions.githubusercontent.com"
60+
}
61+
},
62+
]
63+
Version = "2012-10-17"
64+
}
65+
)
66+
}

0 commit comments

Comments
 (0)