Terraform module for a multi-region Google Cloud Run v2 Service behind a serverless Network Endpoint Group (NEG).
Variables support GPUs, GCS mounts, multi-containers.
| Name | Version |
|---|---|
| ~> 7.0 |
| Name | Version |
|---|---|
| ~> 7.0 |
No modules.
| Name | Type |
|---|---|
| google_cloud_run_v2_service.cloudrun | resource |
| google_cloud_run_v2_service_iam_member.invoker | resource |
| google_compute_backend_service.backend | resource |
| google_compute_region_network_endpoint_group.neg | resource |
| google_project_iam_member.sa_role | resource |
| google_service_account.service_account | resource |
| google_service_account.service_account | data source |
| Name | Description | Type | Default | Required |
|---|---|---|---|---|
| addl_env_vars | Additional environment variables to set in containers | list(object({ |
[] |
no |
| containers | List of container configurations to run in the service. At least one container needs a port. This allows easily configuring multi-container deployments. | list(object({ |
n/a | yes |
| empty_dir_volumes | List of empty directory volumes to create and mount | list(object({ |
[] |
no |
| gcs_volumes | List of Google Cloud Storage buckets to mount as volumes. Must ensure the Cloud Run GSA has proper IAM set on the bucket | list(object({ |
[] |
no |
| gsa | Service account name the Cloud Run service will run as. If empty, creates a new one. | string |
"" |
no |
| invokers | List of members to grant Cloud Run invoker role | list(string) |
[ |
no |
| max_instances | Maximum number of instances to scale to | string |
"100" |
no |
| min_instances | Minimum number of instances to keep running | string |
"0" |
no |
| name | Name of the Cloud Run service | string |
n/a | yes |
| project | The GCP project to use | string |
n/a | yes |
| regions | The GCP region(s) to deploy to | list(string) |
[ |
no |
| secrets | List of Secret Manager secrets to mount as environment variables | list(object({ |
[] |
no |
| skipNeg | Skip creating Network Endpoint Group and Backend Service | bool |
false |
no |
| Name | Description |
|---|---|
| backend | Backend service ID for load balancer (empty if skipNeg is true) |
| gsa | Name of the service account used by Cloud Run |
| gsaEmail | Email address of the service account used by Cloud Run |
| name | Map of region to Cloud Run service names |
| url | Primary Cloud Run service URL (first region) |
| urls | Map of region to Cloud Run service URLs |