Created
July 22, 2022 20:09
-
-
Save nhammad/5d7dd3bcd939f64a6afa78e3894496d0 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 = "schedule" | |
description = "Schedule for Lambda Function" | |
schedule_expression = var.schedule | |
} | |
resource "aws_cloudwatch_event_target" "schedule_lambda" { | |
rule = aws_cloudwatch_event_rule.schedule.name | |
target_id = "processing_lambda" | |
arn = aws_lambda_function.processing_lambda.arn | |
} | |
resource "aws_lambda_permission" "allow_events_bridge_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