From a4d956790606e6828906e253c1af5305b260e90f Mon Sep 17 00:00:00 2001 From: tajewole-moj Date: Wed, 18 Oct 2023 15:10:58 +0100 Subject: [PATCH] added count index --- terraform/environments/apex/lambda.tf | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/terraform/environments/apex/lambda.tf b/terraform/environments/apex/lambda.tf index 50923287bf9..908e408cbfb 100644 --- a/terraform/environments/apex/lambda.tf +++ b/terraform/environments/apex/lambda.tf @@ -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 } \ No newline at end of file