From c09890fc315b846454c5d46c762b1eac5993da96 Mon Sep 17 00:00:00 2001 From: Olivier Cervello Date: Fri, 20 Dec 2019 15:19:04 +0100 Subject: [PATCH 1/3] Fix issue #29 --- outputs.tf | 4 ++-- variables.tf | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/outputs.tf b/outputs.tf index 8617e13..e1db53f 100644 --- a/outputs.tf +++ b/outputs.tf @@ -15,12 +15,12 @@ */ output "name" { - value = var.scheduler_job == null ? google_cloud_scheduler_job.job.0.name : var.scheduler_job.name + value = length(google_cloud_scheduler_job.job) > 0 ? google_cloud_scheduler_job.job.0.name : var.scheduler_job.name description = "The name of the job created" } output "scheduler_job" { - value = var.scheduler_job == null ? google_cloud_scheduler_job.job : var.scheduler_job + value = length(google_cloud_scheduler_job.job) > 0 ? google_cloud_scheduler_job.job.0 : var.scheduler_job description = "The Cloud Scheduler job instance" } diff --git a/variables.tf b/variables.tf index 9ab5e0b..8e3c393 100644 --- a/variables.tf +++ b/variables.tf @@ -151,7 +151,7 @@ variable "time_zone" { } variable "scheduler_job" { - type = object({ name = string }) + type = any description = "An existing Cloud Scheduler job instance" default = null } From 413aace7ff5dbf7e957564935cdf6f197393080c Mon Sep 17 00:00:00 2001 From: Olivier Cervello Date: Fri, 20 Dec 2019 16:27:33 +0100 Subject: [PATCH 2/3] Set outputs to null if no resource created + Restore variable type for scheduler_job --- outputs.tf | 4 ++-- variables.tf | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/outputs.tf b/outputs.tf index e1db53f..673cb2a 100644 --- a/outputs.tf +++ b/outputs.tf @@ -15,12 +15,12 @@ */ output "name" { - value = length(google_cloud_scheduler_job.job) > 0 ? google_cloud_scheduler_job.job.0.name : var.scheduler_job.name + value = length(google_cloud_scheduler_job.job) > 0 ? google_cloud_scheduler_job.job.0.name : null description = "The name of the job created" } output "scheduler_job" { - value = length(google_cloud_scheduler_job.job) > 0 ? google_cloud_scheduler_job.job.0 : var.scheduler_job + value = length(google_cloud_scheduler_job.job) > 0 ? google_cloud_scheduler_job.job.0 : null description = "The Cloud Scheduler job instance" } diff --git a/variables.tf b/variables.tf index 8e3c393..9ab5e0b 100644 --- a/variables.tf +++ b/variables.tf @@ -151,7 +151,7 @@ variable "time_zone" { } variable "scheduler_job" { - type = any + type = object({ name = string }) description = "An existing Cloud Scheduler job instance" default = null } From db1b11004166682e55de68b7bfd9e6573a76acdb Mon Sep 17 00:00:00 2001 From: Olivier Cervello Date: Fri, 20 Dec 2019 16:37:33 +0100 Subject: [PATCH 3/3] Fix lint problem --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d48795e..ee22a74 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ and this project adheres to [Semantic Versioning][semver-site]. ### Added -- The `scheduler_job` variable, the `scheduler_job` output, and the `pubsub_topic_name` output to enable linking multiple +- The `scheduler_job` variable, the `scheduler_job` output, and the `pubsub_topic_name` output to enable linking multiple instances of the module to the same Cloud Scheduler job. [#15] ## [1.3.0] - 2019-12-18