terraform/environment: add gomodstat handler

Run gomodstat every Friday. Gomodstat is an analysis defined elsewhere
that simply collects basic information on a Go module, such as the
presence of a vendor directory, Go version, the number of packages, etc.

The binary is already uploaded and named golang-gomodstat to avoid
possible overwriting by folks that play with the ecosystem metrics
and use gomodstat as their test project.

Change-Id: Id11645974767d6a853c9035a791c389535cb8f73
Reviewed-on: https://go-review.googlesource.com/c/pkgsite-metrics/+/557995
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Zvonimir Pavlinovic <zpavlinovic@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
diff --git a/terraform/environment/worker.tf b/terraform/environment/worker.tf
index ea7142d..cf86261 100644
--- a/terraform/environment/worker.tf
+++ b/terraform/environment/worker.tf
@@ -313,3 +313,22 @@
     }
   }
 }
+
+resource "google_cloud_scheduler_job" "gomodstat" {
+  count       = var.env == "prod" ? 1 : 0
+  name        = "${var.env}-gomodstat"
+  description = "Run gomodstat every week."
+  schedule    = "0 16 * * FRI" # 4PM every Friday
+  time_zone   = local.tz
+  project     = var.project
+
+  attempt_deadline = "1800s" # 30 min max deadline for HTTP target
+  http_target {
+    http_method = "GET"
+    uri         = "${local.worker_url}/analysis/enqueue?binary=golang-gomodstat&skipinit=true&min=0"
+    oidc_token {
+      service_account_email = local.worker_service_account
+      audience              = local.worker_url
+    }
+  }
+}