Map your Cloud Run service to the custom domain

Sample demonstrating how to map your Cloud Run service to a custom domain that you've created. Replace verified-domain.com with your custom verified domain, for example, example.com or subdomain.example.com

Explore further

For detailed documentation that includes this code sample, see the following:

Code sample

Terraform

To learn how to apply or remove a Terraform configuration, see Basic Terraform commands. For more information, see the Terraform provider reference documentation.

data "google_project" "project" {}

resource "google_cloud_run_domain_mapping" "default" {
  name     = "verified-domain.com"
  location = google_cloud_run_v2_service.default.location
  metadata {
    namespace = data.google_project.project.project_id
  }
  spec {
    route_name = google_cloud_run_v2_service.default.name
  }
}

What's next

To search and filter code samples for other Google Cloud products, see the Google Cloud sample browser.