Skip to content

Commit

Permalink
Merge pull request #6 from teamdatatonic/fix/compute_account_count_big
Browse files Browse the repository at this point in the history
fix: fix Terraform 'count' bug
  • Loading branch information
Jonny Browning (Datatonic) authored Oct 12, 2022
2 parents 47a8f96 + 8ff3ecb commit dee8a97
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .tflint.hcl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugin "google" {
enabled = true
version = "0.18.0"
version = "0.20.0"
source = "github.com/terraform-linters/tflint-ruleset-google"
}
8 changes: 3 additions & 5 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@ locals {
# For GCS pipeline spec "rest_of_path" = GCS object name
pipeline_spec_path = regex("^(?P<scheme>(?P<http_scheme>https\\:\\/\\/)|(?P<gs_scheme>gs\\:\\/\\/))?(?P<root>[\\w.-]*)?(?P<rest_of_path_including_slash>(?P<slash>\\/)(?P<rest_of_path>.*))*", 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
Expand Down Expand Up @@ -93,7 +92,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
}

Expand All @@ -116,7 +114,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
}

}
Expand Down

0 comments on commit dee8a97

Please sign in to comment.