Skip to content

Commit

Permalink
Manifest set (#276)
Browse files Browse the repository at this point in the history
  • Loading branch information
sekka1 authored Mar 24, 2022
1 parent 0a9dcd1 commit 50614e3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
4 changes: 2 additions & 2 deletions terraform-modules/aws/kubernetes/manifest_set/main.tf
Original file line number Diff line number Diff line change
@@ -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))
}
15 changes: 15 additions & 0 deletions terraform-modules/aws/kubernetes/manifest_set/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}


Original file line number Diff line number Diff line change
@@ -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"
Expand Down

0 comments on commit 50614e3

Please sign in to comment.