Skip to content
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
bfb30d2
[ndr-387] Added interim grouped tf files
tim-knight-nhs Mar 11, 2026
f95fedd
[ndr-387] formatting applied
tim-knight-nhs Mar 11, 2026
414b7af
[ndr-387] removed hard ref to dev
tim-knight-nhs Mar 11, 2026
6bba36a
[ndr-398] renames files
tim-knight-nhs Mar 12, 2026
e24b86e
[ndr-387] forced sorted output
tim-knight-nhs Mar 12, 2026
ba72295
[ndr-387] fix sorting for consistent build
tim-knight-nhs Mar 12, 2026
467ad29
[ndr-387] Update explodify.py to sort permissions by resource, condit…
tim-knight-nhs Mar 12, 2026
185d69c
[ndr-387] updated sort order
tim-knight-nhs Mar 12, 2026
f111155
[ndr-387] split common file to avoid size limit
tim-knight-nhs Mar 12, 2026
e323f0d
[ndr-387] linting
tim-knight-nhs Mar 12, 2026
c0bad9f
[ndr-387] added comments and better naming of split policies
tim-knight-nhs Mar 12, 2026
f63a61a
[ndr-387] renamed policy documents
tim-knight-nhs Mar 23, 2026
b9355c2
[ndr-387] merged a couple of rules into one
tim-knight-nhs Mar 23, 2026
408ed8c
[ndr-387] merged variants into shared file
tim-knight-nhs Mar 23, 2026
09efdb6
[ndr-387] remove old export files
tim-knight-nhs Mar 23, 2026
db1b229
[ndr-387] removed repeated config
tim-knight-nhs Mar 23, 2026
604a68a
[ndr-387] removed OLD files
tim-knight-nhs Mar 23, 2026
0988966
[ndr-386] renamed main tf files. removed NEW
tim-knight-nhs Mar 23, 2026
3ec1c88
[ndr-387] removed stale comment
tim-knight-nhs Mar 23, 2026
144ced0
[ndr-387] removed repeated permissions
tim-knight-nhs Mar 23, 2026
fb19d75
[ndr-387] moved states permissions to common file
tim-knight-nhs Mar 23, 2026
585451d
[ndr-387] reverting test changes
tim-knight-nhs Mar 24, 2026
f284431
[ndr-387] adding ReadOnlyAccess policy to all
tim-knight-nhs Mar 24, 2026
cb565b3
[ndr-387] removed count for global permissions
tim-knight-nhs Mar 24, 2026
227b4e1
[ndr-387] formatting
tim-knight-nhs Mar 24, 2026
d0f8b49
[ndr-387] removed index on permis
tim-knight-nhs Mar 24, 2026
2b08c10
[ndr-387] renamed dev_test_pre-prod_prod to common
tim-knight-nhs Mar 24, 2026
9b4502b
[ndr-387] comments and rename
tim-knight-nhs Mar 24, 2026
6690bcf
[ndr-387] remove padding
tim-knight-nhs Mar 25, 2026
1827025
[ndr-387] formatting clean-up
tim-knight-nhs Mar 25, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/deploy-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v6
with:
ref: refs/tags/${{ github.event.inputs.git_tag}}
ref: refs/tags/${{ github.event.inputs.git_tag }}
fetch-depth: "0"

- name: Apply base_iam
Expand All @@ -48,7 +48,7 @@ jobs:
- name: Checkout Tag
uses: actions/checkout@v6
with:
ref: refs/tags/${{ inputs.git_tag}}
ref: refs/tags/${{ inputs.git_tag }}
fetch-depth: "0"

- name: Apply Main
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deploy-sandbox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ jobs:
uses: ./.github/actions/tf-plan-apply
with:
# use newly created role
aws_assume_role: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/${{ inputs.sandbox_name}}-github-actions-role
aws_assume_role: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/${{ inputs.sandbox_name }}-github-actions-role
bucket_prefix: "dev"
aws_account_id: ${{ secrets.AWS_ACCOUNT_ID }}
aws_region: ${{ vars.AWS_REGION }}
Expand All @@ -120,7 +120,7 @@ jobs:
uses: ./.github/actions/tf-plan-apply
with:
# use newly created role
aws_assume_role: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/${{ inputs.sandbox_name}}-github-actions-role
aws_assume_role: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/${{ inputs.sandbox_name }}-github-actions-role
bucket_prefix: "dev"
aws_account_id: ${{ secrets.AWS_ACCOUNT_ID }}
aws_region: ${{ vars.AWS_REGION }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deploy-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Checkout branch
uses: actions/checkout@v6
with:
ref: ${{ inputs.git_ref}}
ref: ${{ inputs.git_ref }}

- name: Apply base_iam
uses: ./.github/actions/tf-plan-apply
Expand All @@ -47,7 +47,7 @@ jobs:
- name: Checkout main
uses: actions/checkout@v6
with:
ref: ${{ github.event.inputs.git_ref}}
ref: ${{ github.event.inputs.git_ref }}

- name: Apply Main
uses: ./.github/actions/tf-plan-apply
Expand Down
66 changes: 66 additions & 0 deletions base_iam/iam_github_actions_role.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
resource "aws_iam_role" "github_actions" {
name = "${terraform.workspace}-github-actions-role"
description = "This role provides access for GitHub Actions to the ${terraform.workspace} environment. "
force_detach_policies = false
max_session_duration = 3600
name_prefix = null
path = "/"
permissions_boundary = null
tags = {}
assume_role_policy = local.is_sandbox_or_dev ? jsonencode(
{
Statement = [
{
Action = "sts:AssumeRoleWithWebIdentity"
Condition = {
StringEquals = {
"token.actions.githubusercontent.com:aud" = "sts.amazonaws.com"
}
StringLike = {
"token.actions.githubusercontent.com:sub" = [
"repo:NHSDigital/national-document-repository-infrastructure:*",
"repo:NHSDigital/national-document-repository:*",
]
}
}
Effect = "Allow"
Principal = {
Federated = "arn:aws:iam::${data.aws_caller_identity.current.account_id}:oidc-provider/token.actions.githubusercontent.com"
}
},
{
Action = "sts:AssumeRole"
Effect = "Allow"
Principal = {
AWS = "arn:aws:iam::${data.aws_caller_identity.current.account_id}:role/aws-reserved/sso.amazonaws.com/eu-west-2/AWSReservedSSO_DomainCGpit-Administrators_e00623801cb4b59e"
}
},
]
Version = "2012-10-17"
}
) : jsonencode(
{
Statement = [
{
Action = "sts:AssumeRoleWithWebIdentity"
Comment thread
megan-bower4 marked this conversation as resolved.
Condition = {
StringEquals = {
"token.actions.githubusercontent.com:aud" = "sts.amazonaws.com"
}
StringLike = {
"token.actions.githubusercontent.com:sub" = [
"repo:NHSDigital/national-document-repository-infrastructure:*",
"repo:NHSDigital/national-document-repository:*",
]
}
}
Effect = "Allow"
Principal = {
Federated = "arn:aws:iam::${data.aws_caller_identity.current.account_id}:oidc-provider/token.actions.githubusercontent.com"
}
},
]
Version = "2012-10-17"
}
)
}
Loading
Loading