{"id":26289953,"url":"https://github.com/aashari/terraform-gcp-cloud-run","last_synced_at":"2026-07-16T22:32:56.555Z","repository":{"id":95958753,"uuid":"416966877","full_name":"aashari/terraform-gcp-cloud-run","owner":"aashari","description":"Comprehensive Terraform module for deploying and managing Google Cloud Run services with advanced configuration. Features CI/CD integration, autoscaling rules, monitoring setup, IAM management, VPC connectivity, custom domains, and secret management for containerized applications.","archived":false,"fork":false,"pushed_at":"2025-03-21T16:29:31.000Z","size":43,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-25T01:41:37.728Z","etag":null,"topics":["cloud-run","container","containers","deployment","devops","gcp","google-cloud","infrastructure-as-code","serverless","terraform"],"latest_commit_sha":null,"homepage":"https://github.com/aashari/terraform-gcp-cloud-run","language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aashari.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"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-10-14T02:44:56.000Z","updated_at":"2025-03-21T16:29:35.000Z","dependencies_parsed_at":null,"dependency_job_id":"8cd2cfe4-5988-491f-b5ca-343b7f1b5e07","html_url":"https://github.com/aashari/terraform-gcp-cloud-run","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/aashari/terraform-gcp-cloud-run","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aashari%2Fterraform-gcp-cloud-run","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aashari%2Fterraform-gcp-cloud-run/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aashari%2Fterraform-gcp-cloud-run/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aashari%2Fterraform-gcp-cloud-run/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aashari","download_url":"https://codeload.github.com/aashari/terraform-gcp-cloud-run/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aashari%2Fterraform-gcp-cloud-run/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35560452,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-16T02:00:06.687Z","response_time":83,"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":["cloud-run","container","containers","deployment","devops","gcp","google-cloud","infrastructure-as-code","serverless","terraform"],"created_at":"2025-03-14T23:17:27.486Z","updated_at":"2026-07-16T22:32:56.535Z","avatar_url":"https://github.com/aashari.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Terraform GCP Cloud Run Module\n\n![Terraform](https://img.shields.io/badge/terraform-%235835CC.svg?style=for-the-badge\u0026logo=terraform\u0026logoColor=white)\n![Google Cloud](https://img.shields.io/badge/GoogleCloud-%234285F4.svg?style=for-the-badge\u0026logo=google-cloud\u0026logoColor=white)\n![Version](https://img.shields.io/badge/version-1.1.1-blue.svg?style=for-the-badge)\n\nA comprehensive Terraform module for deploying and managing Google Cloud Run services with advanced configuration options.\n\n## Overview\n\nThis module simplifies the deployment of containerized applications to Google Cloud Run by providing a flexible, reusable Terraform configuration. It handles service account creation, IAM permissions, container configuration, scaling, health checks, VPC connectivity, and custom domain mapping.\n\n## Features\n\n- **Simplified Deployment**: Deploy containerized applications to Cloud Run with minimal configuration\n- **IAM Integration**: Automatic service account creation and IAM role assignment\n- **Scaling Controls**: Configure min/max instances for optimal performance and cost management\n- **Health Checks**: Configure startup and liveness probes for reliable service operation\n- **Networking Options**: Support for VPC connectivity and private services\n- **Custom Domains**: Optional mapping of verified domains to your Cloud Run services\n\n## Architecture\n\nThe module creates and manages the following resources:\n\n- **Google Service Account**: Dedicated service account for the Cloud Run service\n- **IAM Bindings**: Appropriate permissions for the service account\n- **Cloud Run Service**: The main service running your container\n- **Custom Domain Mapping**: (Optional) Maps a verified domain to your service\n\n## Requirements\n\n| Name      | Version            |\n| --------- | ------------------ |\n| terraform | \u003e= 1.11.1          |\n| google    | \u003e= 6.24.0, \u003c 7.0.0 |\n\n## Usage\n\n### Basic Usage\n\n```hcl\nmodule \"cloud_run_service\" {\n  source  = \"github.com/aashari/terraform-gcp-cloud-run?ref=v1.1.1\"\n\n  service_name     = \"my-service\"\n  gcp_project_name = \"my-gcp-project\"\n  gcp_region       = \"us-central1\"\n  image_url        = \"gcr.io/my-project/my-image:latest\"\n}\n```\n\n### Complete Example with All Features\n\n```hcl\nmodule \"cloud_run_service\" {\n  source  = \"github.com/aashari/terraform-gcp-cloud-run?ref=v1.1.1\"\n\n  # Basic configuration\n  service_name     = \"api-service\"\n  gcp_project_name = \"my-gcp-project\"\n  gcp_region       = \"us-central1\"\n  image_url        = \"gcr.io/my-project/api-service:latest\"\n  container_port   = 8080\n\n  # Scaling configuration\n  min_instances = 1\n  max_instances = 10\n\n  # Resource allocation\n  container_cpu    = \"1000m\"\n  container_memory = \"512Mi\"\n  container_concurrency = 50\n  timeout_seconds = 60\n\n  # VPC Connector for private networking\n  vpc_connector = \"projects/my-project/locations/us-central1/connectors/my-connector\"\n  vpc_egress    = \"all-traffic\"\n\n  # Health checks\n  startup_probe_enabled = true\n  startup_probe_type    = \"http_get\"\n  startup_probe_path    = \"/health\"\n  startup_probe_initial_delay_seconds = 5\n\n  liveness_probe_enabled = true\n  liveness_probe_type    = \"http_get\"\n  liveness_probe_path    = \"/health\"\n  liveness_probe_period_seconds = 10\n\n  # Custom domain mapping\n  custom_domain = \"api.example.com\"\n\n  # Environment variables\n  env_vars = {\n    \"NODE_ENV\" = \"production\"\n    \"LOG_LEVEL\" = \"info\"\n    \"DATABASE_URL\" = \"postgres://user:pass@host:port/db\"\n  }\n\n  # Additional annotations\n  service_annotations = {\n    \"run.googleapis.com/ingress\" = \"all\"\n  }\n\n  template_annotations = {\n    \"run.googleapis.com/cpu-throttling\" = \"false\"\n  }\n\n  # Access control (public or private)\n  private_service = false\n}\n```\n\n### Nginx Example\n\n```hcl\nmodule \"nginx_service\" {\n  source  = \"github.com/aashari/terraform-gcp-cloud-run?ref=v1.1.1\"\n\n  service_name     = \"nginx-demo\"\n  gcp_project_name = \"my-gcp-project\"\n  gcp_region       = \"us-central1\"\n  image_url        = \"docker.io/nginx:latest\"\n  container_port   = 80  # Nginx uses port 80 by default\n\n  env_vars = {\n    \"NGINX_ENTRYPOINT_QUIET_LOGS\" = \"1\"\n  }\n\n  # Make the service publicly accessible\n  service_annotations = {\n    \"run.googleapis.com/ingress\" = \"all\"\n  }\n}\n\noutput \"nginx_url\" {\n  value = module.nginx_service.service-endpoint\n  description = \"The URL of the deployed Nginx service\"\n}\n```\n\n## Inputs\n\n| Name                  | Description                                                                       | Type          | Default                      | Required |\n| --------------------- | --------------------------------------------------------------------------------- | ------------- | ---------------------------- | :------: |\n| service_name          | The name of your service (must be unique within the project)                      | `string`      | n/a                          |   yes    |\n| gcp_project_name      | The name of your GCP project                                                      | `string`      | n/a                          |   yes    |\n| gcp_region            | The name of GCP region                                                            | `string`      | n/a                          |   yes    |\n| image_url             | The URL of the container image to deploy (e.g., docker.io/nginx:latest)           | `string`      | n/a                          |   yes    |\n| container_concurrency | The maximum concurrent requests per container                                     | `number`      | `30`                         |    no    |\n| container_port        | The port the container listens on                                                 | `number`      | `3000`                       |    no    |\n| container_cpu         | The amount of CPU allocated for the container                                     | `string`      | `\"2000m\"`                    |    no    |\n| container_memory      | The amount of memory allocated for the container                                  | `string`      | `\"4096Mi\"`                   |    no    |\n| env_vars              | Map of environment variables for the container                                    | `map(string)` | `{\"NODE_ENV\": \"production\"}` |    no    |\n| private_service       | Whether to make the Cloud Run service private                                     | `bool`        | `false`                      |    no    |\n| min_instances         | Minimum number of instances to keep running                                       | `number`      | `0`                          |    no    |\n| max_instances         | Maximum number of instances to scale to                                           | `number`      | `100`                        |    no    |\n| timeout_seconds       | Maximum duration (in seconds) the instance is allowed for responding to a request | `number`      | `300`                        |    no    |\n| vpc_connector         | The VPC connector to use for this service                                         | `string`      | `null`                       |    no    |\n| vpc_egress            | The egress settings for the VPC connector                                         | `string`      | `\"private-ranges-only\"`      |    no    |\n| service_annotations   | Annotations to apply to the Cloud Run service                                     | `map(string)` | `{}`                         |    no    |\n| template_annotations  | Annotations to apply to the Cloud Run service template                            | `map(string)` | `{}`                         |    no    |\n| custom_domain         | Custom domain to map to the Cloud Run service (must be verified in the project)   | `string`      | `\"\"`                         |    no    |\n\n### Health Check Configuration\n\n| Name                                 | Description                                     | Type     | Default        | Required |\n| ------------------------------------ | ----------------------------------------------- | -------- | -------------- | :------: |\n| startup_probe_enabled                | Whether to enable startup probe                 | `bool`   | `false`        |    no    |\n| startup_probe_type                   | Type of startup probe (http_get or tcp_socket)  | `string` | `\"tcp_socket\"` |    no    |\n| startup_probe_path                   | Path for HTTP GET startup probe                 | `string` | `\"/\"`          |    no    |\n| startup_probe_initial_delay_seconds  | Initial delay seconds for startup probe         | `number` | `0`            |    no    |\n| startup_probe_timeout_seconds        | Timeout seconds for startup probe               | `number` | `1`            |    no    |\n| startup_probe_period_seconds         | Period seconds for startup probe                | `number` | `3`            |    no    |\n| startup_probe_failure_threshold      | Failure threshold for startup probe             | `number` | `1`            |    no    |\n| liveness_probe_enabled               | Whether to enable liveness probe                | `bool`   | `false`        |    no    |\n| liveness_probe_type                  | Type of liveness probe (http_get or tcp_socket) | `string` | `\"http_get\"`   |    no    |\n| liveness_probe_path                  | Path for HTTP GET liveness probe                | `string` | `\"/\"`          |    no    |\n| liveness_probe_initial_delay_seconds | Initial delay seconds for liveness probe        | `number` | `0`            |    no    |\n| liveness_probe_timeout_seconds       | Timeout seconds for liveness probe              | `number` | `1`            |    no    |\n| liveness_probe_period_seconds        | Period seconds for liveness probe               | `number` | `3`            |    no    |\n| liveness_probe_failure_threshold     | Failure threshold for liveness probe            | `number` | `3`            |    no    |\n\n## Outputs\n\n| Name             | Description                                                    |\n| ---------------- | -------------------------------------------------------------- |\n| service-name     | The name of the Cloud Run service                              |\n| service-endpoint | The URL of the deployed Cloud Run service                      |\n| service-account  | The email of the service account used by the Cloud Run service |\n\n## License\n\nThis project is licensed under the MIT License - see the LICENSE file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faashari%2Fterraform-gcp-cloud-run","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faashari%2Fterraform-gcp-cloud-run","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faashari%2Fterraform-gcp-cloud-run/lists"}