Skip to content

Instantly share code, notes, and snippets.

@tomdavidson
Created September 1, 2019 08:56
Show Gist options
  • Save tomdavidson/0a41dbbea486ff2ba64b18881c2e57ed to your computer and use it in GitHub Desktop.
Save tomdavidson/0a41dbbea486ff2ba64b18881c2e57ed to your computer and use it in GitHub Desktop.
the find file sub mod
variable "filter" {
type = string
default = "*.yaml"
description = "The pattern used to filter files, i.e. '*.yaml'."
}
variable "search_dir" {
type = string
default = "."
description = "The the directory to search from. Default is '.'."
}
data "external" "find_files" {
program = ["bash", "${path.module}/find.sh"]
working_dir = var.search_dir
query = {
filter = var.filter
}
}
output "files" {
value = split(" ", data.external.find_files.result["key"])
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment