Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .github/workflows/deploy-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ jobs:
if: ${{ inputs.environment == 'dev' && inputs.create_mns_subscription }}
working-directory: "./lambdas/mns_subscription"
env:
APIGEE_ENVIRONMENT: int
SQS_ARN: ${{ env.ID_SYNC_QUEUE_ARN }}
run: |
poetry install --no-root
Expand Down
6 changes: 3 additions & 3 deletions infrastructure/instance/id_sync_lambda.tf
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ resource "aws_iam_policy" "id_sync_lambda_exec_policy" {
"sqs:DeleteMessage",
"sqs:GetQueueAttributes"
],
Resource = "arn:aws:sqs:eu-west-2:${var.immunisation_account_id}:${local.short_prefix}-id-sync-queue"
Resource = aws_sqs_queue.id_sync_queue.arn
},
# NB anomaly: in redis_sync this appears in "redis_sync_lambda_kms_access_policy"
{
Expand Down Expand Up @@ -313,8 +313,8 @@ resource "aws_cloudwatch_log_group" "id_sync_log_group" {

# NEW
resource "aws_lambda_event_source_mapping" "id_sync_sqs_trigger" {
event_source_arn = "arn:aws:sqs:eu-west-2:${var.immunisation_account_id}:${local.short_prefix}-id-sync-queue"
function_name = aws_lambda_function.id_sync_lambda.arn # TODO
event_source_arn = aws_sqs_queue.id_sync_queue.arn
function_name = aws_lambda_function.id_sync_lambda.arn

# Optional: Configure batch size and other settings
batch_size = 10
Expand Down
4 changes: 2 additions & 2 deletions infrastructure/instance/sqs_id_sync.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
resource "aws_sqs_queue" "id_sync_queue" {
name = "${local.short_prefix}-id-sync-queue"
name = "imms-${local.resource_scope}-id-sync-queue"
kms_master_key_id = data.aws_kms_key.existing_id_sync_sqs_encryption_key.arn
visibility_timeout_seconds = 360
redrive_policy = jsonencode({
Expand All @@ -9,7 +9,7 @@ resource "aws_sqs_queue" "id_sync_queue" {
}

resource "aws_sqs_queue" "id_sync_dlq" {
name = "${local.short_prefix}-id-sync-dlq"
name = "imms-${local.resource_scope}-id-sync-dlq"
}

resource "aws_sqs_queue_redrive_allow_policy" "id_sync_queue_redrive_allow_policy" {
Expand Down
5 changes: 4 additions & 1 deletion lambdas/mns_subscription/src/subscribe_mns.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import logging
import os

from mns_setup import get_mns_service

apigee_env = os.getenv("APIGEE_ENVIRONMENT", "int")


def run_subscription():
mns = get_mns_service()
mns = get_mns_service(mns_env=apigee_env)
return mns.check_subscription()


Expand Down
8 changes: 5 additions & 3 deletions lambdas/mns_subscription/src/unsubscribe_mns.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import logging
import os

from mns_setup import get_mns_service

apigee_env = os.getenv("APIGEE_ENVIRONMENT", "int")


def run_unsubscribe():
mns = get_mns_service()
result = mns.check_delete_subscription()
return result
mns = get_mns_service(mns_env=apigee_env)
return mns.check_delete_subscription()


if __name__ == "__main__":
Expand Down
Loading