Google Cloud Run Service

This page shows how to write Terraform for Cloud Run Service and write them securely.

google_cloud_run_service (Terraform)

The Service in Cloud Run can be configured in Terraform with the resource name google_cloud_run_service. The following sections describe 5 examples of how to use the resource and its parameters.

Example Usage from GitHub

resource "google_cloud_run_service" "run_secondary_1" {
  name = "secondary-1"
  location = "us-central1"

  template {
    spec {
resource "google_cloud_run_service" "run_primary_1" {
  name = "primary-1"
  location = "us-east1"

  template {
    spec {
resource "google_cloud_run_service" "app" {
  name                       = "app"
  location                   = "us-east1"
  autogenerate_revision_name = true
  template {
    spec {
resource "google_cloud_run_service" "ingestion_service" {
  name     = var.ingestion_service_name
  location = var.compute_region
  project  = var.project_id

  template {
resource "google_cloud_run_service" "cloud-run-test" {
  name     = "cloud-run-test"
  location = var.DEFAULT_REGION

  template {
    spec {


Explanation in Terraform Registry

Service acts as a top-level container that manages a set of Routes and Configurations which implement a network service. Service exists to provide a singular abstraction which can be access controlled, reasoned about, and which encapsulates software lifecycle decisions such as rollout policy and team resource ownership. Service acts only as an orchestrator of the underlying Routes and Configurations (much as a kubernetes Deployment orchestrates ReplicaSets). The Service's controller will track the statuses of its owned Configuration and Route, reflecting their statuses and conditions as its own. See also: To get more information about Service, see:

  • API documentation
  • How-to Guides
    • Official Documentation

      Warning: google_cloudrun_service creates a Managed Google Cloud Run Service. If you need to create a Cloud Run Service on Anthos(GKE/VMWare) then you will need to create it using the kubernetes alpha provider. Have a look at the Cloud Run Anthos example below.

Frequently asked questions

What is Google Cloud Run Service?

Google Cloud Run Service is a resource for Cloud Run of Google Cloud Platform. Settings can be wrote in Terraform.

Where can I find the example code for the Google Cloud Run Service?

For Terraform, the mike-longledge/ProjectAtyeti, mike-longledge/ProjectAtyeti and theomessin/sandbox source code examples are useful. See the Terraform Example section for further details.


Scan your IaC problem in 3 minutes for free

You can keep your IaC security for free. No credit card required.