Skip to content

Commit c576fe8

Browse files
committed
fix: missing schedule
1 parent 44d2ded commit c576fe8

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

infra/functions-python/main.tf

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,30 @@ resource "google_cloud_scheduler_job" "gbfs_validator_batch_scheduler" {
549549
attempt_deadline = "320s"
550550
}
551551

552+
# Schedule the JBDA import function to run monthly
553+
resource "google_cloud_scheduler_job" "jbda_import_schedule" {
554+
name = "jbda-import-scheduler-${var.environment}"
555+
description = "Schedule the jbda import function"
556+
time_zone = "Etc/UTC"
557+
schedule = var.jbda_scheduler_schedule
558+
region = var.gcp_region
559+
paused = var.environment == "prod" ? false : true
560+
depends_on = [google_cloudfunctions2_function.tasks_executor, google_cloudfunctions2_function_iam_member.tasks_executor_invoker]
561+
http_target {
562+
http_method = "POST"
563+
uri = google_cloudfunctions2_function.tasks_executor.url
564+
oidc_token {
565+
service_account_email = google_service_account.functions_service_account.email
566+
}
567+
headers = {
568+
"Content-Type" = "application/json"
569+
}
570+
body = base64encode("{\"task_name\": \"jbda_import\", \"payload\": {\"dry_run\": \"false\"}}")
571+
}
572+
attempt_deadline = "320s"
573+
}
574+
575+
552576
resource "google_cloud_scheduler_job" "transit_land_scraping_scheduler" {
553577
name = "transitland-scraping-scheduler-${var.environment}"
554578
description = "Schedule the transitland scraping function"

infra/functions-python/vars.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@ variable "gbfs_scheduler_schedule" {
6565
default = "0 0 * * *" # At 00:00 every day
6666
}
6767

68+
variable "jbda_scheduler_schedule" {
69+
type = string
70+
description = "Schedule for the JBDA scheduler job"
71+
default = "0 0 3 * *" # At 00:00 on the 3rd day of every month
72+
}
73+
6874
variable "transitland_scraping_schedule" {
6975
type = string
7076
description = "Schedule Transitland scraping job"

0 commit comments

Comments
 (0)