diff --git a/infrastructure/terraform/components/api/README.md b/infrastructure/terraform/components/api/README.md
index 691e4db76..b4d8adfb4 100644
--- a/infrastructure/terraform/components/api/README.md
+++ b/infrastructure/terraform/components/api/README.md
@@ -34,6 +34,7 @@ No requirements.
| [event\_anomaly\_band\_width](#input\_event\_anomaly\_band\_width) | The width of the anomaly detection band. Higher values (e.g. 4-6) reduce sensitivity and noise, lower values (e.g. 2-3) increase sensitivity. Recommended: 2-4. | `number` | `4` | no |
| [event\_anomaly\_evaluation\_periods](#input\_event\_anomaly\_evaluation\_periods) | Number of evaluation periods for the anomaly alarm. Each period is defined by event\_anomaly\_period. | `number` | `3` | no |
| [event\_anomaly\_period](#input\_event\_anomaly\_period) | The period in seconds over which the specified statistic is applied for anomaly detection. Minimum 300 seconds (5 minutes). Recommended: 300-600. | `number` | `300` | no |
+| [event\_source\_filter](#input\_event\_source\_filter) | SNS subscription source filter values | `list(string)` | n/a | yes |
| [eventpub\_control\_plane\_bus\_arn](#input\_eventpub\_control\_plane\_bus\_arn) | ARN of the EventBridge control plane bus for eventpub | `string` | `""` | no |
| [eventpub\_data\_plane\_bus\_arn](#input\_eventpub\_data\_plane\_bus\_arn) | ARN of the EventBridge data plane bus for eventpub | `string` | `""` | no |
| [force\_destroy](#input\_force\_destroy) | Flag to force deletion of S3 buckets | `bool` | `false` | no |
diff --git a/infrastructure/terraform/components/api/sns_topic_subscription_eventsub_sqs_supplier_allocator.tf b/infrastructure/terraform/components/api/sns_topic_subscription_eventsub_sqs_supplier_allocator.tf
index 59afab801..29127e91c 100644
--- a/infrastructure/terraform/components/api/sns_topic_subscription_eventsub_sqs_supplier_allocator.tf
+++ b/infrastructure/terraform/components/api/sns_topic_subscription_eventsub_sqs_supplier_allocator.tf
@@ -6,6 +6,7 @@ resource "aws_sns_topic_subscription" "eventsub_sqs_supplier_allocator" {
filter_policy_scope = "MessageBody"
filter_policy = jsonencode({
- type = [{ prefix = "uk.nhs.notify.letter-rendering.letter-request.prepared" }]
+ source = var.event_source_filter,
+ type = [{ prefix = "uk.nhs.notify.letter-rendering.letter-request.prepared" }]
})
}
diff --git a/infrastructure/terraform/components/api/variables.tf b/infrastructure/terraform/components/api/variables.tf
index 8bc9eedde..f1499c3fc 100644
--- a/infrastructure/terraform/components/api/variables.tf
+++ b/infrastructure/terraform/components/api/variables.tf
@@ -291,3 +291,8 @@ variable "csoc_destination_account" {
description = "value of the CSOC destination account, if applicable. If null, CSOC destination account will not be added as a resource in the logging policy"
default = "000000000000"
}
+
+variable "event_source_filter" {
+ type = list(string)
+ description = "SNS subscription source filter values"
+}
diff --git a/lambdas/supplier-allocator/src/handler/allocate-handler.ts b/lambdas/supplier-allocator/src/handler/allocate-handler.ts
index a4dd059f0..38adda620 100644
--- a/lambdas/supplier-allocator/src/handler/allocate-handler.ts
+++ b/lambdas/supplier-allocator/src/handler/allocate-handler.ts
@@ -408,6 +408,8 @@ export default function createSupplierAllocatorHandler(deps: Deps): SQSHandler {
messageId: record.messageId,
domainId: letterEvent.data.domainId,
letterVariantId: letterEvent.data.letterVariantId,
+ source: letterEvent.source,
+ type: letterEvent.type,
});
idempotencyConfig.registerLambdaContext(context);