data "external" "instances" { # program = ["bash", "../../modules/util/resource-list/list-${var.resource-type}.sh"] program = ["bash", "${path.module}/list-${var.resource-type}.sh"] query = { input = var.query-input } } output result-set { # value = toset(split(" ", data.external.instances.result.result)) # prevents terraform from returning [""] value = length(data.external.instances.result.result) > 0 ? toset(split(" ", data.external.instances.result.result)) : [] }