File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed
modules/user_kustomizations Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,14 @@ resource "null_resource" "kustomization_user_deploy" {
4242 inline = [
4343 <<- EOT
4444 #!/bin/bash
45+ set -e
46+
47+ function cleanup {
48+ echo "Cleaning up ${ local . base_destination_folder } ..."
49+ rm -rf ${ local . base_destination_folder }
50+ }
51+ trap cleanup EXIT
52+
4553 for dest_folder in ${ join (" " , local. sorted_kustomization_destination_folders )} ; do
4654 if [ -d "$dest_folder" ]; then
4755 echo "Running pre-install script from $dest_folder"
@@ -58,8 +66,6 @@ resource "null_resource" "kustomization_user_deploy" {
5866 /bin/bash "$dest_folder/postinstall.sh"
5967 fi
6068 done
61- echo "Cleaning up ${ local . base_destination_folder } ..."
62- rm -rf ${ local . base_destination_folder } /*
6369 EOT
6470 ]
6571 }
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ variable "kustomizations_map" {
2626 validation {
2727 condition = alltrue ([
2828 for key in keys (var. kustomizations_map ) :
29- tonumber (key) > 0 && floor ( tonumber (key)) == tonumber (key) && can (regex (" ^[0-9]+$" , key))
29+ can (regex (" ^[0-9]+$" , key)) && tonumber (key) > 0
3030 ])
3131 error_message = " All keys in kustomizations_map must be numeric strings (e.g., '1', '2')."
3232 }
You can’t perform that action at this time.
0 commit comments