diff --git a/modules/__experimental/cloud-function-scheduled/README.md b/modules/__experimental/cloud-function-scheduled/README.md index beeb88cf70..df1edce00d 100644 --- a/modules/__experimental/cloud-function-scheduled/README.md +++ b/modules/__experimental/cloud-function-scheduled/README.md @@ -28,7 +28,7 @@ module "function" { | *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. | object({...}) | | ... | +| *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 diff --git a/modules/__experimental/cloud-function-scheduled/main.tf b/modules/__experimental/cloud-function-scheduled/main.tf index ca197f98b1..0d3f03ff5d 100644 --- a/modules/__experimental/cloud-function-scheduled/main.tf +++ b/modules/__experimental/cloud-function-scheduled/main.tf @@ -46,6 +46,7 @@ resource "google_pubsub_topic" "topic" { } resource "google_cloud_scheduler_job" "job" { + count = var.schedule_config.schedule == null ? 0 : 1 project = var.project_id region = var.region name = lookup(local.prefixes, "job", var.name) diff --git a/modules/__experimental/cloud-function-scheduled/variables.tf b/modules/__experimental/cloud-function-scheduled/variables.tf index 6a33f37f2c..78bb4b8cac 100644 --- a/modules/__experimental/cloud-function-scheduled/variables.tf +++ b/modules/__experimental/cloud-function-scheduled/variables.tf @@ -75,7 +75,7 @@ variable "region" { } variable "schedule_config" { - description = "Cloud function scheduler job configuration, leave data null to pass the name variable." + description = "Cloud function scheduler job configuration, leave data null to pass the name variable, set schedule to null to disable schedule." type = object({ pubsub_data = string schedule = string