# Scheduled Google Cloud Function Module This module manages a background Cloud Function scheduled via a recurring Cloud Scheduler job. It also manages the required dependencies: a service account for the cloud function with optional IAM bindings, the PubSub topic used for the function trigger, and optionally the GCS bucket used for the code bundle. ## Example ```hcl module "function" { source = "./modules/cloud-function-scheduled" project_id = "myproject" name = "myfunction" bundle_config = { source_dir = "../cf" output_path = "../bundle.zip" } } ``` ## Variables | name | description | type | required | default | |---|---|:---: |:---:|:---:| | bundle_config | Cloud function code bundle configuration, output path is a zip file. | object({...}) | ✓ | | | name | Name used for resources (schedule, topic, etc.). | string | ✓ | | | project_id | Project id used for all resources. | string | ✓ | | | *bucket_name* | Name of the bucket that will be used for the function code, leave null to create one. | string | | null | | *function_config* | Cloud function configuration. | object({...}) | | ... | | *prefixes* | Optional prefixes for resource ids, null prefixes will be ignored. | object({...}) | | null | | *region* | Region used for all resources. | string | | us-central1 | | *schedule_config* | Cloud function scheduler job configuration, leave data null to pass the name variable, set schedule to null to disable schedule. | object({...}) | | ... | | *service_account_iam_roles* | IAM roles assigned to the service account at the project level. | list(string) | | [] | ## Outputs | name | description | sensitive | |---|---|:---:| | bucket_name | Bucket name. | | | function_name | Cloud function name. | | | service_account_email | Service account email. | | | topic_id | PubSub topic id. | |