Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Managed Prometheus for Cloud Run

Hello,

I have reviewed Cloud Run docs for setting up managed Prometheus for metrics collection (e.g. https://cloud.google.com/stackdriver/docs/managed-prometheus/cloudrun-sidecar) and various other places. While gcloud examples are given, I could not find good references for implementing it with Terraform. Has anyone done this before and got some examples?

Also, we are trying to use `google_cloud_run_v2_service` resource (see more here: https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/cloud_run_v2_service) and it seems like `run.googleapis.com` annotations are not even allowed, even though such annotations as `run.googleapis.com/container-dependencies` need to be included for the cloud run sidecar to work.


0 3 733
3 REPLIES 3

 

 

resource "google_cloud_run_v2_service" "default" {
  name     = "SERVICE"
  location = "REGION"
  ingress = "INGRESS_TRAFFIC_ALL"
  template {
    containers {
      name = "INGRESS_CONTAINER_NAME"
      ports {
        container_port = CONTAINER_PORT
      }
      image = "INGRESS_IMAGE"
      depends_on = ["SIDECAR_CONTAINER_NAME"]
    }
    containers {
      name = "SIDECAR_CONTAINER_NAME"
      image = "SIDECAR_IMAGE"
      }
    }
  }

 

Thank you for the reply. The problem with this is the `run.googleapis.com` annotation not being allowed.

Top Solution Authors