Created
August 9, 2022 14:53
-
-
Save nhammad/f77d24a34ee35668a5fca0aef8b91b2d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "aws_cloudwatch_event_rule" "schedule" { | |
name = local.event_rule_name | |
description = "enabling or disabling alarms at given intervals" | |
schedule_expression = var.schedule | |
} | |
resource "aws_cloudwatch_event_target" "schedule_lambda" { | |
rule = aws_cloudwatch_event_rule.on_schedule.name | |
target_id = "processing_lambda" | |
arn = aws_lambda_function.processing_lambda.arn | |
} | |
resource "aws_lambda_permission" "permission_to_run_lambda" { | |
statement_id = "AllowExecutionFromCloudWatch" | |
action = "lambda:InvokeFunction" | |
function_name = aws_lambda_function.processing_lambda.function_name | |
principal = "events.amazonaws.com" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment