Skip to content

Commit

Permalink
Update terraform target
Browse files Browse the repository at this point in the history
  • Loading branch information
Kamsiy committed Jul 29, 2024
1 parent 443c920 commit f2dae87
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions orchestrator/terraform/modules/heimdall/lambdas.tf
Original file line number Diff line number Diff line change
Expand Up @@ -575,21 +575,39 @@ resource "aws_cloudwatch_event_rule" "repo-dlq-redrive" {
)
}

resource "aws_cloudwatch_event_target" "redrive" {
###############################################################################
# Deadletter Redrive Scheduling
###############################################################################
resource "aws_cloudwatch_event_target" "repo-redrive-target" {
target_id = "${var.app}-redrive"
rule = aws_cloudwatch_event_rule.repo-dlq-redrive.name
arn = aws_lambda_function.redrive_lambda.arn
input = jsonencode({
source = aws_sqs_queue.repo-deadletter-queue.id
destination = aws_sqs_queue.repo-queue.id
})
}

resource "aws_cloudwatch_event_target" "org-redrive-target" {
target_id = "${var.app}-redrive"
rule = aws_cloudwatch_event_rule.org-dlq-redrive.name
arn = aws_lambda_function.redrive_lambda.arn
input = jsonencode({
source = aws_sqs_queue.org-deadletter-queue.id
destination = aws_sqs_queue.org-queue.id
})
}

resource "aws_lambda_permission" "org-redrive-allow-cloudwatch" {
statement_id = "AllowExecutionFromCloudWatch"
statement_id = "AllowExecutionFromCloudWatch1"
action = "lambda:InvokeFunction"
function_name = aws_lambda_function.redrive_lambda.function_name
principal = "events.amazonaws.com"
source_arn = aws_cloudwatch_event_rule.org-dlq-redrive.arn
}

resource "aws_lambda_permission" "repo-redrive-allow-cloudwatch" {
statement_id = "AllowExecutionFromCloudWatch"
statement_id = "AllowExecutionFromCloudWatch2"
action = "lambda:InvokeFunction"
function_name = aws_lambda_function.redrive_lambda.function_name
principal = "events.amazonaws.com"
Expand Down

0 comments on commit f2dae87

Please sign in to comment.