Skip to content

googleCloudRunLocations

Get Cloud Run locations available for a project.

To get more information about Cloud Run, see:

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
new google.dataGoogleCloudRunLocations.DataGoogleCloudRunLocations(
  this,
  "available",
  {}
);

Example Usage: Multi-regional Cloud Run deployment

data "google_cloud_run_locations" "available" {
}

resource "google_cloud_run_service" "service_one" {
  name     = "service-one"
  location = data.google_cloud_run_locations.available.locations[0]

  template {
    spec {
      containers {
        image = "us-docker.pkg.dev/cloudrun/container/hello"
      }
    }
  }
  traffic {
    percent         = 100
    latest_revision = true
  }
}

resource "google_cloud_run_service" "service_two" {
  name     = "service-two"
  location = data.google_cloud_run_locations.available.locations[1]

  template {
    spec {
      containers {
        image = "us-docker.pkg.dev/cloudrun/container/hello""
      }
    }
  }
  traffic {
    percent         = 100
    latest_revision = true
  }
}

Argument Reference

The following arguments are supported:

  • project - (Optional) The project to list versions for. If it is not provided, the provider project is used.

Attributes Reference

The following attributes are exported:

  • locations - The list of Cloud Run locations available for the given project.