diff --git a/terraform-modules/aws/kubernetes/manifest_set/main.tf b/terraform-modules/aws/kubernetes/manifest_set/main.tf index a00a294b7..654fc5f13 100644 --- a/terraform-modules/aws/kubernetes/manifest_set/main.tf +++ b/terraform-modules/aws/kubernetes/manifest_set/main.tf @@ -1,5 +1,5 @@ # Uploads all of the files in the pass in dir path and subdirectories resource "kubernetes_manifest" "this" { - for_each = fileset(var.upload_directory, "**/*.*") - manifest = yamldecode(file("${var.upload_source_path}/${var.upload_directory}/${each.value}")) + for_each = fileset(var.upload_directory, var.fileset_pattern) + manifest = yamldecode(templatefile("${var.upload_source_path}/${var.upload_directory}/${each.value}", var.template_vars)) } diff --git a/terraform-modules/aws/kubernetes/manifest_set/variables.tf b/terraform-modules/aws/kubernetes/manifest_set/variables.tf index 953d758c7..178af7cf3 100644 --- a/terraform-modules/aws/kubernetes/manifest_set/variables.tf +++ b/terraform-modules/aws/kubernetes/manifest_set/variables.tf @@ -4,8 +4,23 @@ variable "upload_directory" { description = "Just the directory name containing the folder to recursively apply from." } +variable "fileset_pattern" { + type = string + default = "**/*.*" + description = "The fileset() pattern match string. Useful if you have other files that are not yaml files that you dont want to add in to be applied to the kube manifest." +} + + variable "upload_source_path" { type = string default = "path.cwd" description = "The full path to where the directory var.upload_directory resides (not including the var.upload_directory dir name)." } + +variable "template_vars" { + type = map + default = {} + description = "The map for the templatefile() function to run the yamls through" +} + + diff --git a/terraform-modules/aws/testkube/base-tests/test-suites/infra-base/main.tf b/terraform-modules/aws/testkube/base-tests/test-suites/infra-base/main.tf index 082390ebf..fef78f42f 100644 --- a/terraform-modules/aws/testkube/base-tests/test-suites/infra-base/main.tf +++ b/terraform-modules/aws/testkube/base-tests/test-suites/infra-base/main.tf @@ -1,5 +1,5 @@ module "manifest_set" { - source = "github.com/ManagedKube/kubernetes-ops.git//terraform-modules/aws/kubernetes/manifest_set?ref=v2.0.11" + source = "github.com/ManagedKube/kubernetes-ops.git//terraform-modules/aws/kubernetes/manifest_set?ref=v2.0.12" upload_source_path = path.cwd upload_directory = "yaml"