File tree Expand file tree Collapse file tree 5 files changed +20
-4
lines changed
Expand file tree Collapse file tree 5 files changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -370,8 +370,12 @@ resource "google_cloud_tasks_queue" "cloud_tasks_dead_letter_queue" {
370370
371371# Create a queue for the cloud tasks
372372# The 2X rate is defined as 4*2 concurrent dispatches and 1 dispatch per second
373+ # The name of the queue need to be dynamic due to GCP limitations
374+ # references:
375+ # - https://cloud.google.com/tasks/docs/deleting-appengine-queues-and-tasks#deleting_queues
376+ # - https://issuetracker.google.com/issues/263947953
373377resource "google_cloud_tasks_queue" "cloud_tasks_2x_rate_queue" {
374- name = " cloud-tasks-2x-rate-queue-${ var . environment } "
378+ name = " cloud-tasks-2x-rate-queue-${ var . environment } - ${ formatdate ( " YYYYMMDDhhmmss " , timestamp ()) } "
375379 location = var. gcp_region
376380
377381 rate_limits {
@@ -388,6 +392,10 @@ resource "google_cloud_tasks_queue" "cloud_tasks_2x_rate_queue" {
388392 }
389393}
390394
395+ output "processing_report_cloud_task_name" {
396+ value = google_cloud_tasks_queue. cloud_tasks_2x_rate_queue . name
397+ }
398+
391399resource "google_cloudfunctions2_function" "process_validation_report" {
392400 name = local. function_process_validation_report_config . name
393401 description = local. function_process_validation_report_config . description
Original file line number Diff line number Diff line change @@ -116,6 +116,7 @@ module "workflows" {
116116 gcp_region = var. gcp_region
117117 environment = var. environment
118118 validator_endpoint = var. validator_endpoint
119+ processing_report_cloud_task_name = module. functions-python . processing_report_cloud_task_name
119120}
120121
121122module "feed-api-load-balancer" {
Original file line number Diff line number Diff line change @@ -90,6 +90,7 @@ resource "google_workflows_workflow" "gtfs_validator_execution" {
9090 reports_bucket_name = lower (var. environment ) == " prod" ? var.reports_bucket_name : " stg-${ var . reports_bucket_name } "
9191 validator_endpoint = var.validator_endpoint
9292 environment = lower (var. environment )
93+ processing_report_cloud_task_name = var.processing_report_cloud_task_name
9394 }
9495 source_contents = file (" ${ path . module } ../../../workflows/gtfs_validator_execution.yml" )
9596}
Original file line number Diff line number Diff line change @@ -51,3 +51,8 @@ variable "validator_endpoint" {
5151 type = string
5252 description = " URL of the validator endpoint"
5353}
54+
55+ variable "processing_report_cloud_task_name" {
56+ type = string
57+ description = " The cloud task name to call the process report task"
58+ }
Original file line number Diff line number Diff line change 1919 - datasetID : ${text.split(data.resourceName, "/")[6]}
2020 - region : ${resource.labels.location}
2121 - projectID : ${resource.labels.project_id}
22- # Extracts the environment from the project ID. Ex: mobility-feeds-prod -> prod. Values: prod, qa, dev
23- - environment : ${text.split(projectID, "-")[2]}
24- - cloudTaskName : ${"cloud-tasks-2x-rate-queue-" + environment}
22+ - environment : ${sys.get_env("environment")}
23+ # The cloud tasks are sensitive to deletion.
24+ # This is why we need to have this as a parameter set at deploying time.
25+ - cloudTaskName : ${sys.get_env("processing_report_cloud_task_name")}
2526 - serviceAccountEmail : ${"workflows-service-account@mobility-feeds-" + environment + ".iam.gserviceaccount.com"}
2627 - url : ${"https://storage.googleapis.com/" + datasetsBucket + "/" + feedID + "/" + datasetID + "/" + datasetID + ".zip"}
2728 - headers :
You can’t perform that action at this time.
0 commit comments