{"id":15156492,"url":"https://github.com/googlecloudplatform/terraform-google-cloud-functions","last_synced_at":"2025-04-09T11:09:45.577Z","repository":{"id":65667146,"uuid":"585637580","full_name":"GoogleCloudPlatform/terraform-google-cloud-functions","owner":"GoogleCloudPlatform","description":"Deploys Cloud Functions (Gen 2)","archived":false,"fork":false,"pushed_at":"2025-03-13T00:28:57.000Z","size":500,"stargazers_count":42,"open_issues_count":17,"forks_count":32,"subscribers_count":26,"default_branch":"main","last_synced_at":"2025-03-30T15:43:47.029Z","etag":null,"topics":["cft-terraform","cloudfunctions","functions","google-cloud-platform","serverless-computing","terraform-modules"],"latest_commit_sha":null,"homepage":"https://registry.terraform.io/modules/GoogleCloudPlatform/cloud-functions/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":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-01-05T17:22:33.000Z","updated_at":"2025-03-21T23:24:58.000Z","dependencies_parsed_at":"2023-02-18T04:45:55.849Z","dependency_job_id":"677417c0-a853-49f7-b2fa-adb2c8edb0e7","html_url":"https://github.com/GoogleCloudPlatform/terraform-google-cloud-functions","commit_stats":{"total_commits":117,"total_committers":18,"mean_commits":6.5,"dds":0.7606837606837606,"last_synced_commit":"d4bf08a5128645e8452a1aa5429999e78c336348"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoogleCloudPlatform%2Fterraform-google-cloud-functions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoogleCloudPlatform%2Fterraform-google-cloud-functions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoogleCloudPlatform%2Fterraform-google-cloud-functions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoogleCloudPlatform%2Fterraform-google-cloud-functions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GoogleCloudPlatform","download_url":"https://codeload.github.com/GoogleCloudPlatform/terraform-google-cloud-functions/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248027406,"owners_count":21035594,"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","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","cloudfunctions","functions","google-cloud-platform","serverless-computing","terraform-modules"],"created_at":"2024-09-26T19:22:13.747Z","updated_at":"2025-04-09T11:09:45.558Z","avatar_url":"https://github.com/GoogleCloudPlatform.png","language":"HCL","readme":"# Terraform Google Cloud Functions (Gen 2) module\n\nThe Terraform module handles the deployment of Cloud Functions (Gen 2) on GCP.\n\nThe resources/services/activations/deletions that this module will create/trigger are:\n\n- Deploy Cloud Functions (2nd Gen) with provided source code and trigger\n- Provide Cloud Functions Invoker or Developer roles to the users and service accounts\n\n## Assumptions and Prerequisites\n\nThis module assumes that below mentioned prerequisites are in place before consuming the module.\n\n* APIs are enabled\n* Permissions are available.\n* You have explicitly granted the necessary IAM roles for the underlying service account used by Cloud Build, `build_service_account`. If `build_service_account` is not specified, then the default compute service account is used, which has [no default IAM roles in new organizations]([url](https://cloud.google.com/resource-manager/docs/secure-by-default-organizations#organization_policies_enforced_on_organization_resources)). At a minimum, the following IAM roles are required for the build service account:\n    * `roles/logging.logWriter`\n    * `roles/storage.objectViewer`\n    * `roles/artifactregistry.writer`\n\n\n## Usage\n\nBasic usage of this module is as follows:\n\n```hcl\nmodule \"cloud_functions2\" {\n  source  = \"GoogleCloudPlatform/cloud-functions/google\"\n  version = \"~\u003e 0.6\"\n\n  # Required variables\n  function_name      = \"\u003cFUNCTION_NAME\u003e\"\n  project_id         = \"\u003cPROJECT_ID\u003e\"\n  function_location  = \"\u003cLOCATION\u003e\"\n  runtime            = \"\u003cRUNTIME\u003e\"\n  entrypoint         = \"\u003cENTRYPOINT\u003e\"\n  storage_source = {\n    bucket      = \"\u003cBUCKET_NAME\u003e\"\n    object      = \"\u003cARCHIVE_PATH\u003e\"\n    generation  = \"\u003cGCS_GENERATION\u003e\"\n  }\n}\n```\n\nFunctional examples are included in the\n[examples](./examples/) directory.\n\n\u003c!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --\u003e\n## Inputs\n\n| Name | Description | Type | Default | Required |\n|------|-------------|------|---------|:--------:|\n| build\\_env\\_variables | User-provided build-time environment variables | `map(string)` | `null` | no |\n| build\\_service\\_account | Cloud Function Build Service Account Id. This is The fully-qualified name of the service account to be used for building the container. | `string` | `null` | no |\n| description | Short description of the function | `string` | `null` | no |\n| docker\\_repository | User managed repository created in Artifact Registry optionally with a customer managed encryption key. | `string` | `null` | no |\n| entrypoint | The name of the function (as defined in source code) that will be executed. Defaults to the resource name suffix, if not specified | `string` | n/a | yes |\n| event\\_trigger | Event triggers for the function | \u003cpre\u003eobject({\u003cbr\u003e    trigger_region        = optional(string)\u003cbr\u003e    event_type            = string\u003cbr\u003e    service_account_email = string\u003cbr\u003e    pubsub_topic          = optional(string)\u003cbr\u003e    retry_policy          = string\u003cbr\u003e    event_filters = optional(set(object({\u003cbr\u003e      attribute       = string\u003cbr\u003e      attribute_value = string\u003cbr\u003e      operator        = optional(string)\u003cbr\u003e    })))\u003cbr\u003e  })\u003c/pre\u003e | `null` | no |\n| function\\_location | The location of this cloud function | `string` | n/a | yes |\n| function\\_name | A user-defined name of the function | `string` | n/a | yes |\n| labels | A set of key/value label pairs associated with this Cloud Function | `map(string)` | `null` | no |\n| members | Cloud Function Invoker and Developer roles for Users/SAs. Key names must be developers and/or invokers | `map(list(string))` | `{}` | no |\n| project\\_id | Project ID to create Cloud Function | `string` | n/a | yes |\n| repo\\_source | Get the source from this location in a Cloud Source Repository | \u003cpre\u003eobject({\u003cbr\u003e    project_id   = optional(string)\u003cbr\u003e    repo_name    = string\u003cbr\u003e    branch_name  = string\u003cbr\u003e    dir          = optional(string)\u003cbr\u003e    tag_name     = optional(string)\u003cbr\u003e    commit_sha   = optional(string)\u003cbr\u003e    invert_regex = optional(bool, false)\u003cbr\u003e  })\u003c/pre\u003e | `null` | no |\n| runtime | The runtime in which to run the function. | `string` | n/a | yes |\n| service\\_config | Details of the service | \u003cpre\u003eobject({\u003cbr\u003e    max_instance_count    = optional(string, 100)\u003cbr\u003e    min_instance_count    = optional(string, 1)\u003cbr\u003e    available_memory      = optional(string, \"256M\")\u003cbr\u003e    available_cpu         = optional(string, 1)\u003cbr\u003e    timeout_seconds       = optional(string, 60)\u003cbr\u003e    runtime_env_variables = optional(map(string), null)\u003cbr\u003e    runtime_secret_env_variables = optional(set(object({\u003cbr\u003e      key_name   = string\u003cbr\u003e      project_id = optional(string)\u003cbr\u003e      secret     = string\u003cbr\u003e      version    = string\u003cbr\u003e    })), null)\u003cbr\u003e    secret_volumes = optional(set(object({\u003cbr\u003e      mount_path = string\u003cbr\u003e      project_id = optional(string)\u003cbr\u003e      secret     = string\u003cbr\u003e      versions = set(object({\u003cbr\u003e        version = string\u003cbr\u003e        path    = string\u003cbr\u003e      }))\u003cbr\u003e    })), null)\u003cbr\u003e    vpc_connector                  = optional(string, null)\u003cbr\u003e    vpc_connector_egress_settings  = optional(string, null)\u003cbr\u003e    ingress_settings               = optional(string, null)\u003cbr\u003e    service_account_email          = optional(string, null)\u003cbr\u003e    all_traffic_on_latest_revision = optional(bool, true)\u003cbr\u003e  })\u003c/pre\u003e | `{}` | no |\n| storage\\_source | Get the source from this location in Google Cloud Storage | \u003cpre\u003eobject({\u003cbr\u003e    bucket     = string\u003cbr\u003e    object     = string\u003cbr\u003e    generation = optional(string, null)\u003cbr\u003e  })\u003c/pre\u003e | `null` | no |\n| worker\\_pool | Name of the Cloud Build Custom Worker Pool that should be used to build the function. | `string` | `null` | no |\n\n## Outputs\n\n| Name | Description |\n|------|-------------|\n| function\\_name | Name of the Cloud Function (Gen 2) |\n| function\\_uri | URI of the Cloud Function (Gen 2) |\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\nThe following dependencies must be available:\n\n- [Terraform][terraform] v1.3+\n- [Terraform Provider for GCP][terraform-provider-gcp] plugin v3.0\n\n### Service Account\n\nA service account with the following roles must be used to provision\nthe resources of this module:\n\n- Storage Admin: `roles/storage.admin`\n- Cloud Functions Admin: `roles/cloudfunctions.admin`\n- Cloud Run Admin: `roles/run.admin`\n- Pub/Sub Admin: `roles/pubsub.admin`\n- Artifact Registry Admin: `roles/artifactregistry.admin`\n- Cloud Build Editor: `roles/cloudbuild.builds.editor`\n- Secret Manager Admin: `roles/secretmanager.admin`\n\nThe [Project Factory module][project-factory-module] and the\n[IAM module][iam-module] may be used in combination to provision a\nservice account with the necessary roles applied.\n\n### APIs\n\nA project with the following APIs enabled must be used to host the\nresources of this module:\n\n- Google Cloud Storage JSON API: `storage-api.googleapis.com`\n- Cloud Functions API: `cloudfunctions.googleapis.com`\n- Cloud Run Admin API: `run.googleapis.com`\n- Cloud Build API: `cloudbuild.googleapis.com`\n- Artifact Registry API: `artifactregistry.googleapis.com`\n- Pub/Sub API: `pubsub.googleapis.com`\n- Secret Manager API: `secretmanager.googleapis.com`\n- EventArc API: `eventarc.googleapis.com`\n\nThe [Project Factory module][project-factory-module] can be used to\nprovision a project with the necessary APIs enabled.\n\n## Contributing\n\nRefer to the [contribution guidelines](./CONTRIBUTING.md) for\ninformation on contributing to this module.\n\n[iam-module]: https://registry.terraform.io/modules/terraform-google-modules/iam/google\n[project-factory-module]: https://registry.terraform.io/modules/terraform-google-modules/project-factory/google\n[terraform-provider-gcp]: https://www.terraform.io/docs/providers/google/index.html\n[terraform]: https://www.terraform.io/downloads.html\n\n## Security Disclosures\n\nPlease see our [security disclosure process](./SECURITY.md).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgooglecloudplatform%2Fterraform-google-cloud-functions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgooglecloudplatform%2Fterraform-google-cloud-functions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgooglecloudplatform%2Fterraform-google-cloud-functions/lists"}