data "external" "instances" { program = ["bash", "${path.module}/list-${var.resource-type}.sh"] query = { input = var.query-input asrolearn = var.asrolearn } } 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)) : [] }