Skip to content

Commit

Permalink
scheduled cloud function module: allow disabling schedule
Browse files Browse the repository at this point in the history
  • Loading branch information
ludoo committed Mar 22, 2020
1 parent dc22224 commit 9c1eb24
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion modules/__experimental/cloud-function-scheduled/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module "function" {
| *function_config* | Cloud function configuration. | <code title="object&#40;&#123;&#10;entry_point &#61; string&#10;instances &#61; number&#10;memory &#61; number&#10;runtime &#61; string&#10;timeout &#61; number&#10;&#125;&#41;">object({...})</code> | | <code title="&#123;&#10;entry_point &#61; &#34;main&#34;&#10;instances &#61; 1&#10;memory &#61; 256&#10;runtime &#61; &#34;python37&#34;&#10;timeout &#61; 180&#10;&#125;">...</code> |
| *prefixes* | Optional prefixes for resource ids, null prefixes will be ignored. | <code title="object&#40;&#123;&#10;bucket &#61; string&#10;function &#61; string&#10;job &#61; string&#10;service_account &#61; string&#10;topic &#61; string&#10;&#125;&#41;">object({...})</code> | | <code title="">null</code> |
| *region* | Region used for all resources. | <code title="">string</code> | | <code title="">us-central1</code> |
| *schedule_config* | Cloud function scheduler job configuration, leave data null to pass the name variable. | <code title="object&#40;&#123;&#10;pubsub_data &#61; string&#10;schedule &#61; string&#10;time_zone &#61; string&#10;&#125;&#41;">object({...})</code> | | <code title="&#123;&#10;schedule &#61; &#34;&#42;&#47;10 &#42; &#42; &#42; &#42;&#34;&#10;pubsub_data &#61; null&#10;time_zone &#61; &#34;UTC&#34;&#10;&#125;">...</code> |
| *schedule_config* | Cloud function scheduler job configuration, leave data null to pass the name variable, set schedule to null to disable schedule. | <code title="object&#40;&#123;&#10;pubsub_data &#61; string&#10;schedule &#61; string&#10;time_zone &#61; string&#10;&#125;&#41;">object({...})</code> | | <code title="&#123;&#10;schedule &#61; &#34;&#42;&#47;10 &#42; &#42; &#42; &#42;&#34;&#10;pubsub_data &#61; null&#10;time_zone &#61; &#34;UTC&#34;&#10;&#125;">...</code> |
| *service_account_iam_roles* | IAM roles assigned to the service account at the project level. | <code title="list&#40;string&#41;">list(string)</code> | | <code title="">[]</code> |

## Outputs
Expand Down
1 change: 1 addition & 0 deletions modules/__experimental/cloud-function-scheduled/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9c1eb24

Please sign in to comment.