{"id":21397581,"url":"https://github.com/multani/terraform-google-function","last_synced_at":"2026-03-19T20:12:59.879Z","repository":{"id":226089167,"uuid":"767715495","full_name":"multani/terraform-google-function","owner":"multani","description":null,"archived":false,"fork":false,"pushed_at":"2024-08-20T20:51:41.000Z","size":10,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-08-20T22:45:21.170Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/multani.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2024-03-05T19:14:33.000Z","updated_at":"2024-03-05T19:53:05.000Z","dependencies_parsed_at":"2024-08-20T22:41:01.252Z","dependency_job_id":null,"html_url":"https://github.com/multani/terraform-google-function","commit_stats":null,"previous_names":["multani/terraform-google-function"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/multani%2Fterraform-google-function","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/multani%2Fterraform-google-function/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/multani%2Fterraform-google-function/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/multani%2Fterraform-google-function/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/multani","download_url":"https://codeload.github.com/multani/terraform-google-function/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243886010,"owners_count":20363649,"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":[],"created_at":"2024-11-22T14:43:37.645Z","updated_at":"2026-01-03T13:08:08.394Z","avatar_url":"https://github.com/multani.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Terraform module to manage Google Cloud Function\n\nThis is a personal (opiniated) Terraform module to manage [Google Cloud Function](https://cloud.google.com/functions/docs/).\n\n## How to use?\n\n```hcl\nmodule \"stuff\" {\n  source  = \"multani/function/google\"\n  version = \"1.0.2\"\n\n  name        = \"do-stuff\"\n  description = \"Do some stuff\"\n\n  location    = \"europe-west6\"\n  runtime     = \"python312\"\n  entry_point = \"stuff_doer\"\n\n  source_code = {\n    bucket = module.functions.bucket\n    object = module.functions.object\n  }\n\n  environment_variables = {\n    SOMETHING = \"stuff\"\n  }\n}\n\n# Authorize stuff to read GCP secrets\nresource \"google_project_iam_member\" \"stuff\" {\n  role    = \"roles/secretmanager.secretAccessor\"\n  member  = \"serviceAccount:${module.stuff.service_account_email}\"\n  project = data.google_project.this.project_id\n}\n```\n\n### Help me, it doesn't work!\n\n\u003e [!IMPORTANT]\n\u003e\n\u003e If you are trying to deploy this module and you authenticate on Google Cloud\n\u003e using a GCP service account (for instance, when running Terraform via\n\u003e Terraform Cloud or a similar service ; in the example below, the service\n\u003e account is called `terraform-sa`), you may get the following error while\n\u003e trying to deploy the function:\n\u003e\n\u003e \u003e Error while updating cloudfunction configuration: googleapi: Error 403: Missing necessary permission `iam.serviceAccounts.actAs` for `terraform-sa` on the service account `fun-stuff@my-gcp-project.iam.gserviceaccount.com`.\n\u003e \u003e\n\u003e \u003e Grant the role `roles/iam.serviceAccountUser` to `terraform-sa` on the service account `functions@multani-admin.iam.gserviceaccount.com`.\n\u003e \u003e You can do that by running `gcloud iam service-accounts add-iam-policy-binding functions@multani-admin.iam.gserviceaccount.com --member=terraform-sa --role=roles/iam.serviceAccountUser`.\n\u003e \u003e In case the member is a service account please use the prefix `serviceAccount:` instead of `user:`.\n\u003e \u003e\n\u003e \u003e If this is a cross-project service account usage ask a project owner to grant you the `iam.serviceAccountUser` role on the service account and/or set the `iam.disableCrossProjectServiceAccountUsage` org policy to `NOT ENFORCED` on the service account project.\n\u003e \u003e\n\u003e \u003e Please visit https://cloud.google.com/functions/docs/troubleshooting for in-depth troubleshooting documentation.\n\u003e\n\u003e Read the [IAM Cloud Function\n\u003e documentation](https://developer.hashicorp.com/terraform/cloud-docs/workspaces)\n\u003e for more information.\n\nIn this case, reconfigure the \"deployer\" service account with the following:\n\n```hcl\nresource \"google_service_account_iam_binding\" \"stuff\" {\n  service_account_id = module.stuff.service_account_name\n  role               = \"roles/iam.serviceAccountUser\"\n\n  # The service account that tries to deploy the Cloud Function\n  members = [\"serviceAccount:${google_service_account.deployer.email}\"]\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmultani%2Fterraform-google-function","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmultani%2Fterraform-google-function","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmultani%2Fterraform-google-function/lists"}