{"id":18706980,"url":"https://github.com/terraform-google-modules/terraform-google-scheduled-function","last_synced_at":"2025-04-05T07:04:06.019Z","repository":{"id":36478041,"uuid":"171515060","full_name":"terraform-google-modules/terraform-google-scheduled-function","owner":"terraform-google-modules","description":"Sets up a scheduled job to trigger events and run functions","archived":false,"fork":false,"pushed_at":"2025-03-28T05:36:14.000Z","size":657,"stargazers_count":71,"open_issues_count":14,"forks_count":48,"subscribers_count":33,"default_branch":"main","last_synced_at":"2025-03-29T06:04:22.380Z","etag":null,"topics":["cft-terraform","serverless-computing"],"latest_commit_sha":null,"homepage":"https://registry.terraform.io/modules/terraform-google-modules/scheduled-function/google","language":"Go","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/terraform-google-modules.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}},"created_at":"2019-02-19T17:05:55.000Z","updated_at":"2025-02-12T00:12:40.000Z","dependencies_parsed_at":"2023-11-16T23:56:28.058Z","dependency_job_id":"f8b8b396-33f2-45c2-b507-ae587b1d615d","html_url":"https://github.com/terraform-google-modules/terraform-google-scheduled-function","commit_stats":null,"previous_names":[],"tags_count":34,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terraform-google-modules%2Fterraform-google-scheduled-function","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terraform-google-modules%2Fterraform-google-scheduled-function/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terraform-google-modules%2Fterraform-google-scheduled-function/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terraform-google-modules%2Fterraform-google-scheduled-function/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/terraform-google-modules","download_url":"https://codeload.github.com/terraform-google-modules/terraform-google-scheduled-function/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247299831,"owners_count":20916190,"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","serverless-computing"],"created_at":"2024-11-07T12:16:15.545Z","updated_at":"2025-04-05T07:04:05.984Z","avatar_url":"https://github.com/terraform-google-modules.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Terraform Google Scheduled Functions Module\n\nThis modules makes it easy to set up a scheduled job to trigger events/run functions.\n\n## Compatibility\nThis module is meant for use with Terraform v1.3+ and tested using Terraform v1.10+.\n If you haven't\n[upgraded](https://www.terraform.io/upgrade-guides/0-13.html) and need a Terraform\n0.12.x-compatible version of this module, the last released version\nintended for Terraform 0.12.x is [v1.6.0](https://registry.terraform.io/modules/terraform-google-modules/scheduled-function/google/1.6.0).\n\n## Usage\nYou can go to the examples folder, however the usage of the module could be like this in your own main.tf file:\n\n```hcl\nmodule \"scheduled-function\" {\n  source  = \"terraform-google-modules/scheduled-function/google\"\n  version = \"0.1.0\"\n  project_id   = \"\u003cPROJECT ID\u003e\"\n  job_name=\"\u003cNAME_OF_JOB\u003e\"\n  job_schedule=\"\u003cCRON_SYNTAX_SCHEDULE\u003e\"\n  function_entry_point=\"\u003cNAME_OF_FUNCTION\u003e\"\n  function_source_directory=\"\u003cDIRECTORY_OF_FUNCTION_SOURCE\u003e\"\n  function_name=\"\u003cRESOURCE_NAMES\u003e\"\n  region=\"\u003cREGION\u003e\"\n}\n```\n\nThen perform the following commands on the root folder:\n\n- `terraform init` to get the plugins\n- `terraform plan` to see the infrastructure plan\n- `terraform apply` to apply the infrastructure build\n- `terraform destroy` to destroy the built infrastructure\n\n\u003c!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --\u003e\n## Inputs\n\n| Name | Description | Type | Default | Required |\n|------|-------------|------|---------|:--------:|\n| bucket\\_force\\_destroy | When deleting the GCS bucket containing the cloud function, delete all objects in the bucket first. | `bool` | `true` | no |\n| bucket\\_name | The name to apply to the bucket. Will default to a string of \u003cproject-id\u003e-scheduled-function-XXXX\u003e with XXXX being random characters. | `string` | `\"\"` | no |\n| create\\_bucket | Create bucket (default). Set to `false` to use existing one | `bool` | `true` | no |\n| files\\_to\\_exclude\\_in\\_source\\_dir | Specify files to ignore when reading the source\\_dir | `list(string)` | `[]` | no |\n| function\\_available\\_memory\\_mb | The amount of memory in megabytes allotted for the function to use. | `number` | `256` | no |\n| function\\_description | The description of the function. | `string` | `\"Processes log export events provided through a Pub/Sub topic subscription.\"` | no |\n| function\\_docker\\_registry | Docker Registry to use for storing the function's Docker images. Allowed values are CONTAINER\\_REGISTRY (default) and ARTIFACT\\_REGISTRY. | `string` | `null` | no |\n| function\\_docker\\_repository | User managed repository created in Artifact Registry optionally with a customer managed encryption key. If specified, deployments will use Artifact Registry. | `string` | `null` | no |\n| function\\_entry\\_point | The name of a method in the function source which will be invoked when the function is executed. | `string` | n/a | yes |\n| function\\_environment\\_variables | A set of key/value environment variable pairs to assign to the function. | `map(string)` | `{}` | no |\n| function\\_event\\_trigger\\_failure\\_policy\\_retry | A toggle to determine if the function should be retried on failure. | `bool` | `false` | no |\n| function\\_kms\\_key\\_name | Resource name of a KMS crypto key (managed by the user) used to encrypt/decrypt function resources. | `string` | `null` | no |\n| function\\_labels | A set of key/value label pairs to assign to the function. | `map(string)` | `{}` | no |\n| function\\_max\\_instances | The maximum number of parallel executions of the function. | `number` | `null` | no |\n| function\\_name | The name to apply to the function | `string` | n/a | yes |\n| function\\_runtime | The runtime in which the function will be executed. | `string` | `\"nodejs10\"` | no |\n| function\\_secret\\_environment\\_variables | A list of maps which contains key, project\\_id, secret\\_name (not the full secret id) and version to assign to the function as a set of secret environment variables. | `list(map(string))` | `[]` | no |\n| function\\_service\\_account\\_email | The service account to run the function as. | `string` | `\"\"` | no |\n| function\\_source\\_archive\\_bucket\\_labels | A set of key/value label pairs to assign to the function source archive bucket. | `map(string)` | `{}` | no |\n| function\\_source\\_dependent\\_files | A list of any terraform created `local_file`s that the module will wait for before creating the archive. | \u003cpre\u003elist(object({\u003cbr\u003e    filename = string\u003cbr\u003e    id       = string\u003cbr\u003e  }))\u003c/pre\u003e | `[]` | no |\n| function\\_source\\_directory | The contents of this directory will be archived and used as the function source. | `string` | n/a | yes |\n| function\\_timeout\\_s | The amount of time in seconds allotted for the execution of the function. | `number` | `60` | no |\n| grant\\_token\\_creator | Specify true if you want to add token creator role to the default Pub/Sub SA | `bool` | `false` | no |\n| ingress\\_settings | The ingress settings for the function. Allowed values are ALLOW\\_ALL, ALLOW\\_INTERNAL\\_AND\\_GCLB and ALLOW\\_INTERNAL\\_ONLY. Changes to this field will recreate the cloud function. | `string` | `null` | no |\n| job\\_description | Addition text to describe the job | `string` | `\"\"` | no |\n| job\\_name | The name of the scheduled job to run | `string` | `null` | no |\n| job\\_schedule | The job frequency, in cron syntax | `string` | `\"*/2 * * * *\"` | no |\n| message\\_data | The data to send in the topic message. | `string` | `\"dGVzdA==\"` | no |\n| project\\_id | The ID of the project where the resources will be created | `string` | n/a | yes |\n| region | The region in which resources will be applied. | `string` | n/a | yes |\n| scheduler\\_job | An existing Cloud Scheduler job instance | `object({ name = string })` | `null` | no |\n| time\\_zone | The timezone to use in scheduler | `string` | `\"Etc/UTC\"` | no |\n| topic\\_kms\\_key\\_name | The resource name of the Cloud KMS CryptoKey to be used to protect access to messages published on this topic. | `string` | `null` | no |\n| topic\\_labels | A set of key/value label pairs to assign to the pubsub topic. | `map(string)` | `{}` | no |\n| topic\\_name | Name of pubsub topic connecting the scheduled job and the function | `string` | `\"test-topic\"` | no |\n| vpc\\_connector | The VPC Network Connector that this cloud function can connect to. It should be set up as fully-qualified URI. The format of this field is projects//locations//connectors/*. | `string` | `null` | no |\n| vpc\\_connector\\_egress\\_settings | The egress settings for the connector, controlling what traffic is diverted through it. Allowed values are ALL\\_TRAFFIC and PRIVATE\\_RANGES\\_ONLY. If unset, this field preserves the previously set value. | `string` | `null` | no |\n\n## Outputs\n\n| Name | Description |\n|------|-------------|\n| name | The name of the job created |\n| pubsub\\_topic\\_name | PubSub topic name |\n| scheduler\\_job | The Cloud Scheduler job instance |\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](https://www.terraform.io/downloads.html) \u003e= 1.3\n- [Terraform Provider for GCP][terraform-provider-gcp] plugin v4.23\n\n### App Engine\nNote that this module requires App Engine being configured in the specified project/region.\nThis is because Google Cloud Scheduler is dependent on the project being configured with App Engine.\nRefer to the [Google Cloud Scheduler documentation][cloud-scheduler-documentation]\ninformation on the App Engine dependency.\n\nThe recommended way to create projects with App Engine enabled is via the [Project Factory module](https://github.com/terraform-google-modules/terraform-google-project-factory).\nThere is an example of how to create the project [within that module](https://github.com/terraform-google-modules/terraform-google-project-factory/tree/master/examples/app_engine)\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- PubSub Editor: `roles/pubsub.editor`\n- Cloudscheduler Admin: `roles/cloudscheduler.admin`\n- Cloudfunctions Developer: `roles/cloudfunctions.developer`\n- IAM ServiceAccount User: `roles/iam.serviceAccountUser`\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- Cloud Scheduler API: `cloudscheduler.googleapis.com`\n- Cloud PubSub API: `pubsub.googleapis.com`\n- Cloud Functions API: `cloudfunctions.googleapis.com`\n- Cloud Build API: `cloudbuild.googleapis.com`\n- App Engine Admin API: `appengine.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[cloud-scheduler-documentation]: https://cloud.google.com/scheduler/docs/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fterraform-google-modules%2Fterraform-google-scheduled-function","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fterraform-google-modules%2Fterraform-google-scheduled-function","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fterraform-google-modules%2Fterraform-google-scheduled-function/lists"}