Skip to content

Commit

Permalink
[PRMP-1123] Disable lambdas from triggering via EventBridge scheduler
Browse files Browse the repository at this point in the history
  • Loading branch information
MohammadIqbalAD-NHS committed Nov 8, 2024
1 parent 9525620 commit e579d19
Showing 1 changed file with 0 additions and 58 deletions.
58 changes: 0 additions & 58 deletions infrastructure/schedules.tf
Original file line number Diff line number Diff line change
Expand Up @@ -57,64 +57,6 @@ resource "aws_lambda_permission" "bulk_upload_report_schedule_permission" {
]
}

resource "aws_cloudwatch_event_rule" "data_collection_schedule" {
name = "${terraform.workspace}_data_collection_schedule"
description = "Schedule for Data Collection Lambda"
schedule_expression = "cron(0 20 * * ? *)"
}

resource "aws_cloudwatch_event_target" "data_collection_schedule_event" {
rule = aws_cloudwatch_event_rule.data_collection_schedule.name
target_id = "data_collection_schedule"

arn = module.data-collection-lambda.lambda_arn
depends_on = [
module.data-collection-lambda,
aws_cloudwatch_event_rule.data_collection_schedule
]
}

resource "aws_lambda_permission" "data_collection_schedule_permission" {
statement_id = "AllowExecutionFromCloudWatch"
action = "lambda:InvokeFunction"
function_name = module.data-collection-lambda.function_name
principal = "events.amazonaws.com"
source_arn = aws_cloudwatch_event_rule.data_collection_schedule.arn
depends_on = [
module.data-collection-lambda,
aws_cloudwatch_event_rule.data_collection_schedule
]
}

resource "aws_cloudwatch_event_rule" "statistical_report_schedule" {
name = "${terraform.workspace}_statistical_report_schedule"
description = "Schedule for Statistical Report Lambda"
schedule_expression = "cron(0 8 ? * 2 *)"
}

resource "aws_cloudwatch_event_target" "statistical_report_schedule_event" {
rule = aws_cloudwatch_event_rule.statistical_report_schedule.name
target_id = "statistical_report_schedule"

arn = module.statistical-report-lambda.lambda_arn
depends_on = [
module.statistical-report-lambda,
aws_cloudwatch_event_rule.statistical_report_schedule
]
}

resource "aws_lambda_permission" "statistical_report_schedule_permission" {
statement_id = "AllowExecutionFromCloudWatch"
action = "lambda:InvokeFunction"
function_name = module.statistical-report-lambda.function_name
principal = "events.amazonaws.com"
source_arn = aws_cloudwatch_event_rule.statistical_report_schedule.arn
depends_on = [
module.statistical-report-lambda,
aws_cloudwatch_event_rule.statistical_report_schedule
]
}

resource "aws_scheduler_schedule" "ods_weekly_update_ecs" {
count = local.is_sandbox ? 0 : 1
name_prefix = "${terraform.workspace}_ods_weekly_update_ecs"
Expand Down

0 comments on commit e579d19

Please sign in to comment.