@@ -836,6 +836,27 @@ resource "google_cloud_scheduler_job" "export_csv_scheduler" {
836836 attempt_deadline = " 600s"
837837}
838838
839+ resource "google_cloud_scheduler_job" "update_feed_status_scheduler" {
840+ name = " update-feed-status-${ var . environment } "
841+ description = " Schedule the update_feed_status function daily"
842+ time_zone = " Etc/UTC"
843+ schedule = var. update_feed_status_schedule
844+ region = var. gcp_region
845+ paused = var. environment == " prod" ? false : true
846+ depends_on = [google_cloudfunctions2_function . update_feed_status , google_cloudfunctions2_function_iam_member . update_feed_status_invoker ]
847+ http_target {
848+ http_method = " POST"
849+ uri = google_cloudfunctions2_function. update_feed_status . url
850+ oidc_token {
851+ service_account_email = google_service_account. functions_service_account . email
852+ }
853+ headers = {
854+ " Content-Type" = " application/json"
855+ }
856+ }
857+ attempt_deadline = " 600s"
858+ }
859+
839860
840861# IAM entry for all users to invoke the function
841862# 12. functions/reverse_geolocation_populate cloud function
@@ -1311,6 +1332,14 @@ resource "google_cloudfunctions2_function_iam_member" "export_csv_invoker" {
13111332 member = " serviceAccount:${ google_service_account . functions_service_account . email } "
13121333}
13131334
1335+ resource "google_cloudfunctions2_function_iam_member" "update_feed_status_invoker" {
1336+ project = var. project_id
1337+ location = var. gcp_region
1338+ cloud_function = google_cloudfunctions2_function. update_feed_status . name
1339+ role = " roles/cloudfunctions.invoker"
1340+ member = " serviceAccount:${ google_service_account . functions_service_account . email } "
1341+ }
1342+
13141343# Grant permissions to the service account to create bigquery jobs
13151344resource "google_project_iam_member" "bigquery_job_user" {
13161345 project = var. project_id
0 commit comments