From 9f7dc681ebb81937a668ee86ff9015a468e00669 Mon Sep 17 00:00:00 2001 From: Jonny Browning Date: Wed, 12 Oct 2022 09:52:47 +0100 Subject: [PATCH 1/3] fix: fix Terraform 'count' bug where var.cloud_scheduler_sa_email not known until apply --- main.tf | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/main.tf b/main.tf index a42dd1e..8d6839c 100644 --- a/main.tf +++ b/main.tf @@ -93,7 +93,6 @@ data "http" "pipeline_spec" { # If a service account is not specified for Cloud Scheduler, use the default compute service account data "google_compute_default_service_account" "default" { - count = (var.cloud_scheduler_sa_email == null) ? 1 : 0 project = var.project } @@ -116,7 +115,7 @@ resource "google_cloud_scheduler_job" "job" { body = base64encode(jsonencode(local.pipeline_job)) oauth_token { - service_account_email = (var.cloud_scheduler_sa_email == null) ? data.google_compute_default_service_account.default[0].email : var.cloud_scheduler_sa_email + service_account_email = (var.cloud_scheduler_sa_email == null) ? data.google_compute_default_service_account.default.email : var.cloud_scheduler_sa_email } } From bc299ab2f61fbc2f339f9ab343c11da9b2eed158 Mon Sep 17 00:00:00 2001 From: Jonny Browning Date: Wed, 12 Oct 2022 10:05:04 +0100 Subject: [PATCH 2/3] chore: bump tflint plugin version --- .tflint.hcl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.tflint.hcl b/.tflint.hcl index 1111a80..00d3dbc 100644 --- a/.tflint.hcl +++ b/.tflint.hcl @@ -1,5 +1,5 @@ plugin "google" { enabled = true - version = "0.18.0" + version = "0.20.0" source = "github.com/terraform-linters/tflint-ruleset-google" } From 8ff3ecb1ef31bbe50f797d7e3d1f2bb04a4d87dc Mon Sep 17 00:00:00 2001 From: Jonny Browning Date: Wed, 12 Oct 2022 10:12:43 +0100 Subject: [PATCH 3/3] style: remove redundant local variable --- main.tf | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/main.tf b/main.tf index 8d6839c..63d0bb6 100644 --- a/main.tf +++ b/main.tf @@ -31,9 +31,8 @@ locals { # For GCS pipeline spec "rest_of_path" = GCS object name pipeline_spec_path = regex("^(?P(?Phttps\\:\\/\\/)|(?Pgs\\:\\/\\/))?(?P[\\w.-]*)?(?P(?P\\/)(?P.*))*", var.pipeline_spec_path) - pipeline_spec_path_is_gcs_path = local.pipeline_spec_path.scheme == "gs://" - pipeline_spec_path_is_ar_path = local.pipeline_spec_path.scheme == "https://" - pipeline_spec_path_is_local_path = local.pipeline_spec_path.scheme == null + pipeline_spec_path_is_gcs_path = local.pipeline_spec_path.scheme == "gs://" + pipeline_spec_path_is_ar_path = local.pipeline_spec_path.scheme == "https://" # Load the pipeline spec from YAML/JSON # If it's a GCS path, load it from the GCS object content