From bf2338192342f4ffdc61574942c69b005200c153 Mon Sep 17 00:00:00 2001 From: Quentin Manfroi Date: Tue, 6 Aug 2019 22:39:40 +0200 Subject: [PATCH] MON-492 inform in readme when monitor is disabled by default --- scripts/02_update_readme.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/scripts/02_update_readme.sh b/scripts/02_update_readme.sh index 769ee36..d4ae053 100755 --- a/scripts/02_update_readme.sh +++ b/scripts/02_update_readme.sh @@ -88,8 +88,17 @@ EOF IFS=$(echo -en "\n\b") # loop over each monitor in the set for match in $(grep -E ^[[:space:]]+name[[:space:]]+= $(basename ${path}) | sort -fdbi); do + ## TODO rewrite this (and other things) using: + ## terraform-config-inspect --json| jq -C + ## awk '1;/^\}/{exit}' monitors-ingress.tf # with line numer of each resource # parse monitor's name name=$(get_name "${match}") + # search if monitor is enabled + [[ "$(grep -B1 "$name" $(basename ${path}) | grep enabled)" =~ ^[[:space:]]*count[[:space:]]*=[[:space:]]*var\.([a-z0-9_]*_enabled) ]] && + # add "disabled by default" mention if not enabled + if ! grep -A4 "${BASH_REMATCH[1]}" inputs.tf | grep default.*true; then + name="${name} (disabled by default)" + fi # monitor name element to the list and replace "could reach" pattern to "forecast" for better naming echo "- ${name/could reach/forecast}" >> README.md done