Skip to content

Commit 547f6b1

Browse files
authored
Merge branch 'main' into feature/CCM-12997
2 parents 10ec08f + 92573c0 commit 547f6b1

File tree

16 files changed

+129
-22
lines changed

16 files changed

+129
-22
lines changed

.github/workflows/stage-1-commit.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,16 @@ jobs:
152152
timeout-minutes: 10
153153
needs: detect-terraform-changes
154154
if: needs.detect-terraform-changes.outputs.terraform_changed == 'true'
155+
env:
156+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
155157
steps:
156158
- name: "Checkout code"
157159
uses: actions/checkout@v5
160+
- name: Setup NodeJS
161+
uses: actions/setup-node@v4
162+
with:
163+
node-version: ${{ inputs.nodejs_version }}
164+
registry-url: 'https://npm.pkg.github.com'
158165
- name: "Setup ASDF"
159166
uses: asdf-vm/actions/setup@v4
160167
- name: "Trivy Scan"
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
resource "aws_lambda_event_source_mapping" "letter_updates_transformer_kinesis" {
2-
event_source_arn = aws_kinesis_stream.letter_change_stream.arn
3-
function_name = module.letter_updates_transformer.function_arn
4-
starting_position = "LATEST"
5-
batch_size = 10
6-
maximum_batching_window_in_seconds = 1
2+
event_source_arn = aws_kinesis_stream.letter_change_stream.arn
3+
function_name = module.letter_updates_transformer.function_arn
4+
starting_position = "LATEST"
5+
batch_size = 10
6+
maximum_batching_window_in_seconds = 1
77

88
depends_on = [
9-
module.letter_updates_transformer # ensures updates transformer exists
9+
module.letter_updates_transformer # ensures updates transformer exists
1010
]
1111
}

infrastructure/terraform/components/api/locals.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,7 @@ locals {
2828
APIM_CORRELATION_HEADER = "nhsd-correlation-id",
2929
DOWNLOAD_URL_TTL_SECONDS = 60
3030
}
31+
32+
core_pdf_bucket_arn = "arn:aws:s3:::comms-${var.core_account_id}-eu-west-2-${var.core_environment}-api-stg-pdf-pipeline"
33+
core_s3_kms_key_alias_name = "alias/comms-${var.core_environment}-api-s3"
3134
}

infrastructure/terraform/components/api/module_lambda_get_letter_data.tf

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,43 @@ data "aws_iam_policy_document" "get_letter_data_lambda" {
6868
]
6969
}
7070

71+
statement {
72+
sid = "S3ListBucketForPresign"
73+
actions = [
74+
"s3:ListBucket"
75+
]
76+
resources = [
77+
module.s3bucket_test_letters.arn,
78+
local.core_pdf_bucket_arn
79+
]
80+
}
81+
7182
statement {
7283
sid = "S3GetObjectForPresign"
7384
actions = [
7485
"s3:GetObject",
75-
"s3:ListBucket"] # allows 404 response instead of 403 if object missing
76-
resources = ["${module.s3bucket_test_letters.arn}/*"]
86+
"s3:PutObject",
87+
] # allows 404 response instead of 403 if object missing
88+
resources = [
89+
"${module.s3bucket_test_letters.arn}/*",
90+
"${local.core_pdf_bucket_arn}/*",
91+
]
92+
}
93+
94+
statement {
95+
sid = "KMSForCoreS3Access"
96+
actions = [
97+
"kms:Decrypt",
98+
"kms:GenerateDataKey",
99+
"kms:DescribeKey"
100+
]
101+
resources = [
102+
"arn:aws:kms:${var.region}:${var.core_account_id}:key/*"
103+
]
104+
condition {
105+
test = "ForAnyValue:StringEquals"
106+
variable = "kms:ResourceAliases"
107+
values = [local.core_s3_kms_key_alias_name]
108+
}
77109
}
78110
}

infrastructure/terraform/components/api/variables.tf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,4 +142,16 @@ variable "letter_variant_map" {
142142
"lv2" = { supplierId = "supplier1", specId = "spec2" },
143143
"lv3" = { supplierId = "supplier2", specId = "spec3" }
144144
}
145+
146+
variable "core_account_id" {
147+
type = string
148+
description = "AWS Account ID for Core"
149+
default = "000000000000"
150+
}
151+
152+
variable "core_environment" {
153+
type = string
154+
description = "Environment of Core"
155+
default = "prod"
156+
145157
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"message": "Bad Gateway"
3+
}
Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
{
2-
"errors": [
3-
{
4-
"code": "NOTIFY_QUOTA",
5-
"detail": "You have made too many requests. Please try again later.",
6-
"id": "rrt-1931948104716186917-c-geu2-10664-3111479-3.0",
7-
"links": {
8-
"about": "https://digital.nhs.uk/developer/api-catalogue/nhs-notify-supplier"
9-
},
10-
"status": "429",
11-
"title": "Too many requests"
12-
}
13-
]
2+
"interval": 1,
3+
"limit": 1,
4+
"message": "Your application, Notify-Supplier-App-Restricted - Internal Dev 2, has exceeded its quota of 1 requests every 1 minute(s) and is being rate limited.",
5+
"message_id": "rrt-4773181658036170775-c-geu2-321623-73628915-2",
6+
"policy": "quota",
7+
"ratelimiting_expiry_time_ms": 1765372560000,
8+
"scope": "application",
9+
"timeunit": "minute"
1410
}

specification/api/components/endpoints/createMI.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@ responses:
1515
$ref: "../responses/errors/tooManyRequests.yml"
1616
'500':
1717
$ref: "../responses/errors/serverError.yml"
18+
'502':
19+
$ref: "../responses/errors/badGateway.yml"

specification/api/components/endpoints/getDataId.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,5 @@ responses:
1313
$ref: "../responses/errors/tooManyRequests.yml"
1414
"500":
1515
$ref: "../responses/errors/serverError.yml"
16+
"502":
17+
$ref: "../responses/errors/badGateway.yml"

specification/api/components/endpoints/getLetterStatus.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,7 @@ responses:
1111
$ref: "../responses/errors/tooManyRequests.yml"
1212
"500":
1313
$ref: "../responses/errors/serverError.yml"
14+
"502":
15+
$ref: "../responses/errors/badGateway.yml"
1416
tags:
1517
- letter

0 commit comments

Comments
 (0)