2026-09-21 19:34:24 +00:00
|
|
|
# EventBridge Scheduler in Eastern time. Replaces dual EST/EDT Lambda crons.
|
|
|
|
|
|
|
|
|
|
locals {
|
|
|
|
|
job_schedules = {
|
|
|
|
|
close = {
|
|
|
|
|
description = "Close form Thursday 11:59pm Eastern"
|
|
|
|
|
schedule = "cron(59 23 ? * THU *)"
|
|
|
|
|
event = "close"
|
|
|
|
|
}
|
|
|
|
|
reminder = {
|
|
|
|
|
description = "DM reminders Thursday 10am Eastern"
|
|
|
|
|
schedule = "cron(0 10 ? * THU *)"
|
|
|
|
|
event = "reminder"
|
|
|
|
|
}
|
|
|
|
|
sync-roster = {
|
|
|
|
|
description = "Sync roster Monday 6:55am Eastern, before menu publish"
|
|
|
|
|
schedule = "cron(55 6 ? * MON *)"
|
|
|
|
|
event = "sync_roster"
|
|
|
|
|
}
|
2026-09-25 22:10:24 +00:00
|
|
|
publish-menu = {
|
|
|
|
|
description = "Publish the weekly menu Monday 7:30am Eastern"
|
|
|
|
|
schedule = "cron(30 7 ? * MON *)"
|
|
|
|
|
event = "publish_menu"
|
|
|
|
|
}
|
2026-09-21 19:34:24 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
resource "aws_scheduler_schedule_group" "jobs" {
|
|
|
|
|
name = local.project
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
resource "aws_scheduler_schedule" "jobs" {
|
|
|
|
|
for_each = local.job_schedules
|
|
|
|
|
|
|
|
|
|
name = "${local.project}-${each.key}"
|
|
|
|
|
group_name = aws_scheduler_schedule_group.jobs.name
|
|
|
|
|
description = each.value.description
|
|
|
|
|
schedule_expression = each.value.schedule
|
|
|
|
|
schedule_expression_timezone = "America/New_York"
|
|
|
|
|
state = local.is_prod ? "ENABLED" : "DISABLED"
|
|
|
|
|
flexible_time_window {
|
|
|
|
|
mode = "OFF"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
target {
|
|
|
|
|
arn = aws_sqs_queue.jobs.arn
|
|
|
|
|
role_arn = aws_iam_role.scheduler.arn
|
|
|
|
|
input = jsonencode({ event = each.value.event })
|
|
|
|
|
}
|
|
|
|
|
}
|