Skip to content

Commit

Permalink
updating sqs perms and triggers
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-heery committed Jan 2, 2025
1 parent d4bfedc commit c0b4a29
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
# ---------------------------------------
resource "aws_sns_topic_subscription" "live_serco_fms_sns_subscription" {
topic_arn = aws_sns_topic.live_serco_fms_s3_events.arn
protocol = "lambda"
endpoint = module.format_json_fms_data.lambda_function_arn
protocol = "sqs"
endpoint = module.format_json_fms_data.lambda_dlq_arn
}

resource "aws_lambda_permission" "live_serco_fms_with_sns" {
statement_id = "LiveServcoFMSLambdaAllowExecutionFromSNS"
action = "lambda:InvokeFunction"
function_name = module.format_json_fms_data.lambda_function_name
principal = "sns.amazonaws.com"
source_arn = aws_sns_topic.live_serco_fms_s3_events.arn
source_arn = module.format_json_fms_data.lambda_dlq_arn
}


Expand All @@ -21,14 +21,14 @@ resource "aws_lambda_permission" "live_serco_fms_with_sns" {
# ---------------------------------------
resource "aws_sns_topic_subscription" "historic_sns_subscription" {
topic_arn = aws_sns_topic.historic_s3_events.arn
protocol = "lambda"
endpoint = module.calculate_checksum.lambda_function_arn
protocol = "sqs"
endpoint = module.calculate_checksum.lambda_dlq_arn
}

resource "aws_lambda_permission" "historic_with_sns" {
statement_id = "ChecksumLambdaAllowExecutionFromHistoricDataSNS"
action = "lambda:InvokeFunction"
function_name = module.calculate_checksum.lambda_function_name
principal = "sns.amazonaws.com"
source_arn = aws_sns_topic.historic_s3_events.arn
source_arn = module.calculate_checksum.lambda_dlq_arn
}
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,10 @@ data "aws_iam_policy_document" "lambda_dlq_policy" {
actions = [
"sqs:SendMessage",
"sqs:GetQueueAttributes",
"sqs:GetQueueUrl"
"sqs:GetQueueUrl",
"sqs:ReceiveMessage",
"sqs:DeleteMessage",
"sqs:ChangeMessageVisibility"
]
resources = [aws_sqs_queue.lambda_dlq.arn]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ output "lambda_function_arn" {
output "lambda_function_invoke_arn" {
value = aws_lambda_function.this.invoke_arn
}

output "lambda_function_dlq_arn" {
value = aws_sqs_queue.lambda_dlq.arn
}

0 comments on commit c0b4a29

Please sign in to comment.