Skip to content

Commit

Permalink
added count index
Browse files Browse the repository at this point in the history
  • Loading branch information
tajewole-moj committed Oct 18, 2023
1 parent 5edd770 commit a4d9567
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions terraform/environments/apex/lambda.tf
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,16 @@ resource "aws_cloudwatch_event_rule" "mon_sun" {
}

resource "aws_cloudwatch_event_target" "check_mon_sun" {
count = 3
rule = aws_cloudwatch_event_rule.mon_sun.name
arn = module.lambda_backup.lambda_function
arn = module.lambda_backup[count.index].lambda_function
}

resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" {
count = 3
statement_id = "AllowExecutionFromCloudWatch"
action = "lambda:InvokeFunction"
function_name = module.lambda_backup.lambda_function_name
function_name = module.lambda_backup[count.index].lambda_function_name
principal = "events.amazonaws.com"
source_arn = aws_cloudwatch_event_rule.mon_sun.arn
}

0 comments on commit a4d9567

Please sign in to comment.