From 31788225a533becb56bad748a3dd3eb6c3052a66 Mon Sep 17 00:00:00 2001 From: Hazzaz Imtiaz Date: Fri, 14 Aug 2026 12:16:55 +0100 Subject: [PATCH 1/3] BRANCH ARNS - Populate EVENT.SP_GOALS_COMPLETE and EVENT.SP_GOALS_DATE from ARNS via SNS Notification --- .../sentence-plan-and-delius-queue.tf | 83 +++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 namespaces/live.cloud-platform.service.justice.gov.uk/hmpps-probation-integration-services-preprod/resources/sentence-plan-and-delius-queue.tf diff --git a/namespaces/live.cloud-platform.service.justice.gov.uk/hmpps-probation-integration-services-preprod/resources/sentence-plan-and-delius-queue.tf b/namespaces/live.cloud-platform.service.justice.gov.uk/hmpps-probation-integration-services-preprod/resources/sentence-plan-and-delius-queue.tf new file mode 100644 index 00000000000..9f8d7295828 --- /dev/null +++ b/namespaces/live.cloud-platform.service.justice.gov.uk/hmpps-probation-integration-services-preprod/resources/sentence-plan-and-delius-queue.tf @@ -0,0 +1,83 @@ +resource "aws_sns_topic_subscription" "sentence-plan-and-delius-queue-subscription" { + topic_arn = data.aws_sns_topic.hmpps-domain-events.arn + protocol = "sqs" + endpoint = module.sentence-plan-and-delius-queue.sqs_arn + filter_policy = jsonencode({ + eventType = [ + "sentence-plan-community.referral.status-updated", + "sentence-plan-community.programme.complete", + ] + }) +} + +module "sentence-plan-and-delius-queue" { + source = "github.com/ministryofjustice/cloud-platform-terraform-sqs?ref=5.1.2" + + # Queue configuration + sqs_name = "sentence-plan-and-delius-queue" + redrive_policy = jsonencode({ + deadLetterTargetArn = module.sentence-plan-and-delius-dlq.sqs_arn + maxReceiveCount = 3 + }) + + # Tags + application = "sentence-plan-and-delius" + business_unit = var.business_unit + environment_name = var.environment_name + infrastructure_support = var.infrastructure_support + is_production = var.is_production + namespace = var.namespace + team_name = var.team_name +} + +resource "aws_sqs_queue_policy" "sentence-plan-and-delius-queue-policy" { + queue_url = module.sentence-plan-and-delius-queue.sqs_id + policy = data.aws_iam_policy_document.sqs_queue_policy_document.json +} + +module "sentence-plan-and-delius-dlq" { + source = "github.com/ministryofjustice/cloud-platform-terraform-sqs?ref=5.1.2" + + # Queue configuration + sqs_name = "sentence-plan-and-delius-dlq" + message_retention_seconds = 7 * 24 * 3600 # 1 week + + # Tags + application = "sentence-plan-and-delius" + business_unit = var.business_unit + environment_name = var.environment_name + infrastructure_support = var.infrastructure_support + is_production = var.is_production + namespace = var.namespace + team_name = var.team_name +} + +resource "aws_sqs_queue_policy" "sentence-plan-and-delius-dlq-policy" { + queue_url = module.sentence-plan-and-delius-dlq.sqs_id + policy = data.aws_iam_policy_document.sqs_queue_policy_document.json +} + +resource "kubernetes_secret" "sentence-plan-and-delius-queue-secret" { + metadata { + name = "sentence-plan-and-delius-queue" + namespace = var.namespace + } + data = { + QUEUE_NAME = module.sentence-plan-and-delius-queue.sqs_name + } +} + +module "sentence-plan-and-delius-service-account" { + source = "github.com/ministryofjustice/cloud-platform-terraform-irsa?ref=2.1.0" + application = var.application + business_unit = var.business_unit + eks_cluster_name = var.eks_cluster_name + environment_name = var.environment_name + infrastructure_support = var.infrastructure_support + is_production = var.is_production + namespace = var.namespace + team_name = var.team_name + + service_account_name = "sentence-plan-and-delius" + role_policy_arns = { sqs = module.sentence-plan-and-delius-queue.irsa_policy_arn } +} \ No newline at end of file From d6205ad7f16476d88b35f920bfe8831e93a2e325 Mon Sep 17 00:00:00 2001 From: Hazzaz Imtiaz Date: Fri, 14 Aug 2026 12:48:21 +0100 Subject: [PATCH 2/3] Update event types, queue, dlq --- .../resources/iam.tf | 2 ++ .../resources/sentence-plan-and-delius-queue.tf | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/namespaces/live.cloud-platform.service.justice.gov.uk/hmpps-probation-integration-services-preprod/resources/iam.tf b/namespaces/live.cloud-platform.service.justice.gov.uk/hmpps-probation-integration-services-preprod/resources/iam.tf index 6ed82d44fff..5611d43f8a4 100644 --- a/namespaces/live.cloud-platform.service.justice.gov.uk/hmpps-probation-integration-services-preprod/resources/iam.tf +++ b/namespaces/live.cloud-platform.service.justice.gov.uk/hmpps-probation-integration-services-preprod/resources/iam.tf @@ -132,6 +132,7 @@ data "aws_iam_policy_document" "sqs_management_policy_document" { module.tier-to-delius-queue.sqs_arn, module.unpaid-work-and-delius-queue.sqs_arn, module.workforce-allocations-to-delius-queue.sqs_arn, + module.sentence-plan-and-delius-queue.sqs_arn, ] dlq = [ module.warrant-risk-assessment-and-delius-dlq.sqs_arn, @@ -167,6 +168,7 @@ data "aws_iam_policy_document" "sqs_management_policy_document" { module.tier-to-delius-dlq.sqs_arn, module.unpaid-work-and-delius-dlq.sqs_arn, module.workforce-allocations-to-delius-dlq.sqs_arn, + module.sentence-plan-and-delius-dlq.sqs_arn, ], external = [ data.aws_sqs_queue.hmpps-tier-events-queue.arn, diff --git a/namespaces/live.cloud-platform.service.justice.gov.uk/hmpps-probation-integration-services-preprod/resources/sentence-plan-and-delius-queue.tf b/namespaces/live.cloud-platform.service.justice.gov.uk/hmpps-probation-integration-services-preprod/resources/sentence-plan-and-delius-queue.tf index 9f8d7295828..864957578a0 100644 --- a/namespaces/live.cloud-platform.service.justice.gov.uk/hmpps-probation-integration-services-preprod/resources/sentence-plan-and-delius-queue.tf +++ b/namespaces/live.cloud-platform.service.justice.gov.uk/hmpps-probation-integration-services-preprod/resources/sentence-plan-and-delius-queue.tf @@ -4,8 +4,8 @@ resource "aws_sns_topic_subscription" "sentence-plan-and-delius-queue-subscripti endpoint = module.sentence-plan-and-delius-queue.sqs_arn filter_policy = jsonencode({ eventType = [ - "sentence-plan-community.referral.status-updated", - "sentence-plan-community.programme.complete", + "arns.sentence.plan.goals.added", + "arns.sentence.plan.goals.completed", ] }) } From 630077d0cbb194371f13c06c40d459a3ff679b0d Mon Sep 17 00:00:00 2001 From: Hazzaz Imtiaz Date: Fri, 14 Aug 2026 15:29:10 +0100 Subject: [PATCH 3/3] Empty - Commit