{"id":14957948,"url":"https://github.com/googlecloudplatform/terraform-google-cloud-run","last_synced_at":"2026-02-12T07:48:30.073Z","repository":{"id":37852067,"uuid":"380773904","full_name":"GoogleCloudPlatform/terraform-google-cloud-run","owner":"GoogleCloudPlatform","description":"Deploys apps to Cloud Run, along with option to map custom domain","archived":false,"fork":false,"pushed_at":"2025-09-30T14:48:56.000Z","size":1095,"stargazers_count":184,"open_issues_count":34,"forks_count":132,"subscribers_count":38,"default_branch":"main","last_synced_at":"2025-09-30T16:30:03.539Z","etag":null,"topics":["cft-terraform","cloudrun","google-cloud-platform","serverless-computing","terraform-modules"],"latest_commit_sha":null,"homepage":"https://registry.terraform.io/modules/GoogleCloudPlatform/cloud-run/google","language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GoogleCloudPlatform.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-06-27T15:26:34.000Z","updated_at":"2025-09-30T14:44:46.000Z","dependencies_parsed_at":"2023-10-11T03:55:00.600Z","dependency_job_id":"d6f89fac-bf4a-47d0-87cf-9d131908561e","html_url":"https://github.com/GoogleCloudPlatform/terraform-google-cloud-run","commit_stats":{"total_commits":196,"total_committers":26,"mean_commits":7.538461538461538,"dds":0.8163265306122449,"last_synced_commit":"4b318b715f9006d1f2247d5d584be4a6b22e11da"},"previous_names":[],"tags_count":40,"template":false,"template_full_name":null,"purl":"pkg:github/GoogleCloudPlatform/terraform-google-cloud-run","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoogleCloudPlatform%2Fterraform-google-cloud-run","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoogleCloudPlatform%2Fterraform-google-cloud-run/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoogleCloudPlatform%2Fterraform-google-cloud-run/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoogleCloudPlatform%2Fterraform-google-cloud-run/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GoogleCloudPlatform","download_url":"https://codeload.github.com/GoogleCloudPlatform/terraform-google-cloud-run/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoogleCloudPlatform%2Fterraform-google-cloud-run/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278693039,"owners_count":26029424,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-06T02:00:05.630Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cft-terraform","cloudrun","google-cloud-platform","serverless-computing","terraform-modules"],"created_at":"2024-09-24T13:15:53.037Z","updated_at":"2026-02-12T07:48:30.066Z","avatar_url":"https://github.com/GoogleCloudPlatform.png","language":"HCL","readme":"# Terraform Cloud Run Module\n\nThis module handles the basic deployment of containerized applications on Cloud Run, along with domain mapping and IAM policy for the service.\n\nThe resources/services/activations/deletions that this module will create/trigger are:\n\n* Creates a Cloud Run service with provided name and container\n* Creates Domain mapping for the deployed service\n* Applies Cloud Run Invoker role to members\n\n## Mapping custom domains and subdomains\n\nYou can map multiple custom domains and subdomains to the same Cloud Run service. If you want to register a domain with Cloud Domains, see [Registering a domain with Cloud Domains within the Cloud Run console](https://cloud.google.com/run/docs/mapping-custom-domains#register-domain).\n\nTo add a custom domain or subdomain to your Cloud Run service, you need to add the values to the `verified_domain_name` variable.\n\nBefore you've mapped your service to a custom domain in Cloud Run, you need to update your DNS records at your domain registry.\nIf you're using Cloud DNS as your DNS provider, see [Adding a record](https://cloud.google.com/dns/docs/records#adding_a_record).\n\nIn case your DNS is not managed by Google Cloud Domains, the ownership of your domain needs to be verified adding a `txt record` on your DNS configuration. This verification can be done following the steps from [this documentation](https://cloud.google.com/identity/docs/verify-domain-txt).\n\n## Assumptions and Prerequisites\n\nThis module assumes that below mentioned prerequisites are in place before consuming the module.\n\n* All required APIs are enabled in the GCP Project\n* Cloud SQL (optional)\n* VPC Connector (optional)\n* Environment Variables in Secret Manager (optional)\n\n## Usage\n\nBasic usage of this module is as follows:\n\n```hcl\nmodule \"cloud_run\" {\n  source  = \"GoogleCloudPlatform/cloud-run/google\"\n  # Locked to 0.20, allows minor updates – check for latest version\n  version = \"~\u003e 0.25\"\n\n  # Required variables\n  service_name           = \"\u003cSERVICE NAME\u003e\"\n  project_id             = \"\u003cPROJECT ID\u003e\"\n  location               = \"\u003cLOCATION\u003e\"\n  image                  = \"gcr.io/cloudrun/hello\"\n}\n```\n\n\u003c!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --\u003e\n## Inputs\n\n| Name | Description | Type | Default | Required |\n|------|-------------|------|---------|:--------:|\n| argument | Arguments passed to the ENTRYPOINT command, include these only if image entrypoint needs arguments | `list(string)` | `[]` | no |\n| certificate\\_mode | The mode of the certificate (NONE or AUTOMATIC) | `string` | `\"NONE\"` | no |\n| container\\_command | Leave blank to use the ENTRYPOINT command defined in the container image, include these only if image entrypoint should be overwritten | `list(string)` | `[]` | no |\n| container\\_concurrency | Concurrent request limits to the service | `number` | `null` | no |\n| domain\\_map\\_annotations | Annotations to the domain map | `map(string)` | `{}` | no |\n| domain\\_map\\_labels | A set of key/value label pairs to assign to the Domain mapping | `map(string)` | `{}` | no |\n| encryption\\_key | CMEK encryption key self-link expected in the format projects/PROJECT/locations/LOCATION/keyRings/KEY-RING/cryptoKeys/CRYPTO-KEY. | `string` | `null` | no |\n| env\\_secret\\_vars | [Beta] Environment variables (Secret Manager) | \u003cpre\u003elist(object({\u003cbr\u003e    name = string\u003cbr\u003e    value_from = set(object({\u003cbr\u003e      secret_key_ref = map(string)\u003cbr\u003e    }))\u003cbr\u003e  }))\u003c/pre\u003e | `[]` | no |\n| env\\_vars | Environment variables (cleartext) | \u003cpre\u003elist(object({\u003cbr\u003e    value = string\u003cbr\u003e    name  = string\u003cbr\u003e  }))\u003c/pre\u003e | `[]` | no |\n| force\\_override | Option to force override existing mapping | `bool` | `false` | no |\n| generate\\_revision\\_name | Option to enable revision name generation | `bool` | `true` | no |\n| image | GCR hosted image URL to deploy | `string` | n/a | yes |\n| limits | Resource limits to the container | `map(string)` | `null` | no |\n| liveness\\_probe | Periodic probe of container liveness. Container will be restarted if the probe fails.\u003cbr\u003eMore info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes | \u003cpre\u003eobject({\u003cbr\u003e    failure_threshold     = optional(number, null)\u003cbr\u003e    initial_delay_seconds = optional(number, null)\u003cbr\u003e    timeout_seconds       = optional(number, null)\u003cbr\u003e    period_seconds        = optional(number, null)\u003cbr\u003e    http_get = optional(object({\u003cbr\u003e      path = optional(string)\u003cbr\u003e      http_headers = optional(list(object({\u003cbr\u003e        name  = string\u003cbr\u003e        value = string\u003cbr\u003e      })), null)\u003cbr\u003e    }), null)\u003cbr\u003e    grpc = optional(object({\u003cbr\u003e      port    = optional(number)\u003cbr\u003e      service = optional(string)\u003cbr\u003e    }), null)\u003cbr\u003e  })\u003c/pre\u003e | `null` | no |\n| location | Cloud Run service deployment location | `string` | n/a | yes |\n| members | Users/SAs to be given invoker access to the service | `list(string)` | `[]` | no |\n| ports | Port which the container listens to (http1 or h2c) | \u003cpre\u003eobject({\u003cbr\u003e    name = string\u003cbr\u003e    port = number\u003cbr\u003e  })\u003c/pre\u003e | \u003cpre\u003e{\u003cbr\u003e  \"name\": \"http1\",\u003cbr\u003e  \"port\": 8080\u003cbr\u003e}\u003c/pre\u003e | no |\n| project\\_id | The project ID to deploy to | `string` | n/a | yes |\n| requests | Resource requests to the container | `map(string)` | `{}` | no |\n| service\\_account\\_email | Service Account email needed for the service | `string` | `\"\"` | no |\n| service\\_annotations | Annotations to the service. Acceptable values all, internal, internal-and-cloud-load-balancing | `map(string)` | \u003cpre\u003e{\u003cbr\u003e  \"run.googleapis.com/ingress\": \"all\"\u003cbr\u003e}\u003c/pre\u003e | no |\n| service\\_labels | A set of key/value label pairs to assign to the service | `map(string)` | `{}` | no |\n| service\\_name | The name of the Cloud Run service to create | `string` | n/a | yes |\n| startup\\_probe | Startup probe of application within the container.\u003cbr\u003eAll other probes are disabled if a startup probe is provided, until it succeeds.\u003cbr\u003eContainer will not be added to service endpoints if the probe fails.\u003cbr\u003eMore info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes | \u003cpre\u003eobject({\u003cbr\u003e    failure_threshold     = optional(number, null)\u003cbr\u003e    initial_delay_seconds = optional(number, null)\u003cbr\u003e    timeout_seconds       = optional(number, null)\u003cbr\u003e    period_seconds        = optional(number, null)\u003cbr\u003e    http_get = optional(object({\u003cbr\u003e      path = optional(string)\u003cbr\u003e      http_headers = optional(list(object({\u003cbr\u003e        name  = string\u003cbr\u003e        value = string\u003cbr\u003e      })), null)\u003cbr\u003e    }), null)\u003cbr\u003e    tcp_socket = optional(object({\u003cbr\u003e      port = optional(number)\u003cbr\u003e    }), null)\u003cbr\u003e    grpc = optional(object({\u003cbr\u003e      port    = optional(number)\u003cbr\u003e      service = optional(string)\u003cbr\u003e    }), null)\u003cbr\u003e  })\u003c/pre\u003e | `null` | no |\n| template\\_annotations | Annotations to the container metadata including VPC Connector and SQL. See [more details](https://cloud.google.com/run/docs/reference/rpc/google.cloud.run.v1#revisiontemplate) | `map(string)` | \u003cpre\u003e{\u003cbr\u003e  \"autoscaling.knative.dev/maxScale\": 2,\u003cbr\u003e  \"autoscaling.knative.dev/minScale\": 1,\u003cbr\u003e  \"generated-by\": \"terraform\",\u003cbr\u003e  \"run.googleapis.com/client-name\": \"terraform\"\u003cbr\u003e}\u003c/pre\u003e | no |\n| template\\_labels | A set of key/value label pairs to assign to the container metadata | `map(string)` | `{}` | no |\n| timeout\\_seconds | Timeout for each request | `number` | `120` | no |\n| traffic\\_split | Managing traffic routing to the service | \u003cpre\u003elist(object({\u003cbr\u003e    latest_revision = bool\u003cbr\u003e    percent         = number\u003cbr\u003e    revision_name   = string\u003cbr\u003e    tag             = string\u003cbr\u003e  }))\u003c/pre\u003e | \u003cpre\u003e[\u003cbr\u003e  {\u003cbr\u003e    \"latest_revision\": true,\u003cbr\u003e    \"percent\": 100,\u003cbr\u003e    \"revision_name\": \"v1-0-0\",\u003cbr\u003e    \"tag\": null\u003cbr\u003e  }\u003cbr\u003e]\u003c/pre\u003e | no |\n| verified\\_domain\\_name | List of Custom Domain Name | `list(string)` | `[]` | no |\n| volume\\_mounts | [Beta] Volume Mounts to be attached to the container (when using secret) | \u003cpre\u003elist(object({\u003cbr\u003e    mount_path = string\u003cbr\u003e    name       = string\u003cbr\u003e  }))\u003c/pre\u003e | `[]` | no |\n| volumes | [Beta] Volumes needed for environment variables (when using secret) | \u003cpre\u003elist(object({\u003cbr\u003e    name = string\u003cbr\u003e    secret = set(object({\u003cbr\u003e      secret_name = string\u003cbr\u003e      items       = map(string)\u003cbr\u003e    }))\u003cbr\u003e  }))\u003c/pre\u003e | `[]` | no |\n\n## Outputs\n\n| Name | Description |\n|------|-------------|\n| apphub\\_service\\_uri | Service URI in CAIS style to be used by Apphub. |\n| domain\\_map\\_id | Unique Identifier for the created domain map |\n| domain\\_map\\_status | Status of Domain mapping |\n| location | Location in which the Cloud Run service was created |\n| project\\_id | Google Cloud project in which the service was created |\n| revision | Deployed revision for the service |\n| service\\_id | Unique Identifier for the created service |\n| service\\_name | Name of the created service |\n| service\\_status | Status of the created service |\n| service\\_url | The URL on which the deployed service is available |\n| verified\\_domain\\_name | List of Custom Domain Name |\n\n\u003c!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK --\u003e\n\n## Requirements\n\nThese sections describe requirements for using this module.\n\n### Software\n- [Terraform](https://www.terraform.io/downloads.html) ~\u003e v1.3+\n- [Terraform Provider for GCP](https://github.com/terraform-providers/terraform-provider-google) \u003c 6\n- [Terraform Provider for GCP Beta](https://github.com/terraform-providers/terraform-provider-google-beta) \u003c 6\n\n### Service Account\n\nA service account can be used with required roles to execute this module:\n\n- Cloud Run Admin: `roles/run.admin`\n\nKnow more about [Cloud Run Deployment Permissions](https://cloud.google.com/run/docs/reference/iam/roles#additional-configuration).\n\nThe [Project Factory module](https://registry.terraform.io/modules/terraform-google-modules/project-factory/google/latest) and the\n[IAM module](https://registry.terraform.io/modules/terraform-google-modules/iam/google/latest) may be used in combination to provision a service account with the necessary roles applied.\n\n### APIs\n\nA project with the following APIs enabled must be used to host the main resource of this module:\n\n- Google Cloud Run: `run.googleapis.com`\n- Serverless VPC Access (optional): `vpcaccess.googleapis.com`\n- Cloud SQL (optional): `sqladmin.googleapis.com`\n\n## Contributing\n\nRefer to the [contribution guidelines](./CONTRIBUTING.md) for\ninformation on contributing to this module.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgooglecloudplatform%2Fterraform-google-cloud-run","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgooglecloudplatform%2Fterraform-google-cloud-run","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgooglecloudplatform%2Fterraform-google-cloud-run/lists"}