Skip to content

Commit 25995ad

Browse files
committed
Allow running user_kustomizations with just post-install actions and without kustomization.yaml
1 parent 975e3d0 commit 25995ad

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

modules/user_kustomizations/locals.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
locals {
22
sorted_kustomization_destination_folders = [
33
for idx in sort([
4-
for key, mod in module.user_kustomization_set : tonumber(key) if mod.files_count > 0
4+
for key, mod in module.user_kustomization_set : tonumber(key)
55
]) :
66
module.user_kustomization_set[tostring(idx)].destination_folder
77
]

modules/user_kustomizations/main.tf

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,12 @@ resource "null_resource" "kustomization_user_deploy" {
4242
#!/bin/bash
4343
for dest_folder in ${join(" ", local.sorted_kustomization_destination_folders)}; do
4444
if [ -d "$dest_folder" ]; then
45-
echo "Applying kustomization from $dest_folder"
46-
kubectl apply -k "$dest_folder"
45+
if [ -f "$dest_folder/kustomization.yaml" ]; then
46+
echo "Applying kustomization from $dest_folder"
47+
kubectl apply -k "$dest_folder"
48+
else
49+
echo "No kustomization.yaml in $dest_folder, skipping apply."
50+
fi
4751
echo "Running post-install script from $dest_folder"
4852
/bin/bash "$dest_folder/postinstall.sh"
4953
fi

0 commit comments

Comments
 (0)