Tagging Cloud Run services via terraform

Written on 24 Oct 2024, 3 min read.

Today I learned the magic incantation to apply a GCP Resource Manager tag to a Cloud Run service via terraform:

resource "google_tags_location_tag_binding" "service" {
  parent    = "//run.googleapis.com/projects/PROJECT_NUMER/locations/REGION/services/SERVICE_NAME"
  tag_value = "tagValue/TAG_ID"
  location  = "REGION"
}

This came about while I was trying to create a public Cloud Run service within an organisation with domain restricted sharing policies enabled. Rather than YOLO-ing it via the CLI/console as that post suggests, I wanted to create the tags, values and bindings via terraform.

Continue reading...