I am trying to run a scheduler (firebase function)
export const notificationScheduler = onSchedule('*/5 * * * *', async() => {
sendNotification();
But I wonder how I can use terraform to deploy the scheduler. So far, my attempt is to rewrite this function as an express application and use
resource "google_cloud_scheduler_job" "job" {
name = var.scheduler_name
project = var.project
region = var.region
schedule = var.schedule
time_zone = "Europe/Paris"
attempt_deadline = "320s"
http_target {
http_method = "GET"
uri = "${google_cloudfunctions_function.function.https_trigger_url}/scheduler/update-episode"
oidc_token {
service_account_email = google_service_account.service_account.email
}
}
}
But I wonder if there is not a way to deploy the scheduler directly without having to rewrite it as a request to an express server