Skip to content

Commit 25d2d8f

Browse files
merge latest from feature/CCM-12180-TestsOnPipeline into my branch
2 parents c68acc2 + 4693211 commit 25d2d8f

File tree

6 files changed

+58
-9
lines changed

6 files changed

+58
-9
lines changed

infrastructure/terraform/components/api/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ No requirements.
1313
| <a name="input_ca_pem_filename"></a> [ca\_pem\_filename](#input\_ca\_pem\_filename) | Filename for the CA truststore file within the s3 bucket | `string` | `null` | no |
1414
| <a name="input_commit_id"></a> [commit\_id](#input\_commit\_id) | The commit to deploy. Must be in the tree for branch\_name | `string` | `"HEAD"` | no |
1515
| <a name="input_component"></a> [component](#input\_component) | The variable encapsulating the name of this component | `string` | `"supapi"` | no |
16+
| <a name="input_core_account_id"></a> [core\_account\_id](#input\_core\_account\_id) | AWS Account ID for Core | `string` | `"000000000000"` | no |
17+
| <a name="input_core_environment"></a> [core\_environment](#input\_core\_environment) | Environment of Core | `string` | `"prod"` | no |
1618
| <a name="input_default_tags"></a> [default\_tags](#input\_default\_tags) | A map of default tags to apply to all taggable resources within the component | `map(string)` | `{}` | no |
1719
| <a name="input_disable_gateway_execute_endpoint"></a> [disable\_gateway\_execute\_endpoint](#input\_disable\_gateway\_execute\_endpoint) | Disable the execution endpoint for the API Gateway | `bool` | `true` | no |
1820
| <a name="input_enable_backups"></a> [enable\_backups](#input\_enable\_backups) | Enable backups | `bool` | `false` | no |
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
@@ -155,3 +155,15 @@ variable "letter_variant_map" {
155155
"lv3" = { supplierId = "supplier2", specId = "spec3" }
156156
}
157157
}
158+
159+
variable "core_account_id" {
160+
type = string
161+
description = "AWS Account ID for Core"
162+
default = "000000000000"
163+
}
164+
165+
variable "core_environment" {
166+
type = string
167+
description = "Environment of Core"
168+
default = "prod"
169+
}

tests/helpers/generate-fetch-test-data.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ export async function checkSupplierExists(
105105

106106
export async function createSupplierEntry(supplierId: string): Promise<void> {
107107
await createSupplierData({
108-
filter: "nhs-notify-supplier-api-letter-test-data-utility",
108+
filter: "nhs-notify-supplier-api-suppliers-data-utility",
109109
supplierId,
110110
apimId: supplierId,
111111
name: "TestSupplier",

0 commit comments

Comments
 (0)