diff --git a/scripts/03_update_module.sh b/scripts/03_update_module.sh index 5ee4795..ca9dc8c 100755 --- a/scripts/03_update_module.sh +++ b/scripts/03_update_module.sh @@ -4,6 +4,8 @@ set -xueo pipefail source "$(dirname $0)/utils.sh" goto_root +root=$(basename $(pwd)) + # loop over every monitors set for path in $(find "$(get_scope $1)" -path ./incubator -prune -o -name 'monitors-*.tf' -print | sort -fdbi); do cd $(dirname $path) @@ -11,10 +13,16 @@ for path in $(find "$(get_scope $1)" -path ./incubator -prune -o -name 'monitors resource="$(basename $(dirname $path))" # if modules.tf does not exist AND if this set respect our tagging convention if ! [ -f modules.tf ] && grep -q filter_tags_use_defaults inputs.tf; then + relative="" + current="$(pwd)" + while [[ "$(basename $current)" != "$root" ]]; do + relative="${relative}../" + current="$(dirname $current)" + done # add the filter tags module cat > modules.tf <