Skip to content

Commit

Permalink
fix: Only instantiate external data resource if module is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
bharathkkb authored Aug 13, 2020
1 parent 829c9ff commit c47859c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ locals {
gcloud_bin_abs_path = abspath(local.gcloud_bin_path)
components = join(",", var.additional_components)

download_override = data.external.env_override.result.download
download_override = data.external.env_override[0].result.download
skip_download = local.download_override == "always" ? false : (local.download_override == "never" ? true : var.skip_download)

gcloud = local.skip_download ? "gcloud" : "${local.gcloud_bin_path}/gcloud"
Expand Down Expand Up @@ -68,9 +68,10 @@ resource "null_resource" "module_depends_on" {
}

data "external" "env_override" {
program = ["${path.module}/scripts/check_env.sh"]
count = var.enabled ? 1 : 0

query = {}
program = ["${path.module}/scripts/check_env.sh"]
query = {}
}

resource "null_resource" "prepare_cache" {
Expand Down

0 comments on commit c47859c

Please sign in to comment.