This module encapsulates producing a sidecar image for publishing otel collected
metrics, and granting the service account as which the sidecar runs permission
to write those metrics (so it's impossible to forget):
module "otel-collector" {
source = "chainguard-dev/common/infra//modules/otel-collector"
project_id = var.project_id
service_account = google_service_account.this.email
}
resource "google_cloud_run_v2_service" "this" {
template {
service_account = google_service_account.this.email
containers {
image = "..."
// Specifying port is necessary when there are multiple containers.
ports { container_port = 8080 }
}
// Install the sidecar!
containers { image = module.otel-collector.image }
}
}