From c10a4da315820f7c09f581de184e799fe697e04c Mon Sep 17 00:00:00 2001 From: Quentin Manfroi Date: Thu, 27 Jun 2019 13:03:48 +0200 Subject: [PATCH] MON-459 update script to delete testing and incubator directories --- scripts/01_update_output.sh | 2 +- scripts/02_update_readme.sh | 4 ++-- scripts/03_update_module.sh | 2 +- scripts/90_best_practices.sh | 2 +- scripts/99_terraform.sh | 2 +- testing/dummy/dummy.tf | 3 --- testing/dummy/versions.tf | 4 ---- testing/inputs.tf | 22 ---------------------- testing/main.tf | 4 ---- testing/modules.tf | 12 ------------ 10 files changed, 6 insertions(+), 51 deletions(-) delete mode 100644 testing/dummy/dummy.tf delete mode 100644 testing/dummy/versions.tf delete mode 100644 testing/inputs.tf delete mode 100644 testing/main.tf delete mode 100644 testing/modules.tf diff --git a/scripts/01_update_output.sh b/scripts/01_update_output.sh index 0e117db..eb0167f 100755 --- a/scripts/01_update_output.sh +++ b/scripts/01_update_output.sh @@ -5,7 +5,7 @@ source "$(dirname $0)/utils.sh" goto_root # loop over every monitors set -for path in $(find "$(get_scope $1)" -path ./incubator -prune -o -name 'monitors-*.tf' -print | sort -fdbi); do +for path in $(find "$(get_scope $1)" -name 'monitors-*.tf' -print | sort -fdbi); do cd $(dirname $path) # empty outputs > outputs.tf diff --git a/scripts/02_update_readme.sh b/scripts/02_update_readme.sh index 7918e9f..eba210e 100755 --- a/scripts/02_update_readme.sh +++ b/scripts/02_update_readme.sh @@ -10,7 +10,7 @@ sed -i '/### Monitors summary ###/q' README.md # add a newline after listing section echo >> README.md # loop over all ready monitors sets on the repo -for path in $(find -mindepth 1 \( -path './incubator' -o -path './scripts' -o -path './testing' -o -path '*/\.*' \) -prune -o -type d -print | sort -fdbi); do +for path in $(find -mindepth 1 -type d ! -path '*/.*' ! -path './scripts*' -print | sort -fdbi); do # split path in directories directories=($(list_dirs $path)) # loop over directories in path @@ -32,7 +32,7 @@ done PATTERN_DOC="Related documentation" # loop over every monitors set readme -for path in $(find "$(get_scope $1)" -path ./incubator -prune -o -name 'monitors-*.tf' -print | sort -fdbi); do +for path in $(find "$(get_scope $1)" -name 'monitors-*.tf' -print | sort -fdbi); do cd $(dirname $path) EXIST=0 if [ -f README.md ]; then diff --git a/scripts/03_update_module.sh b/scripts/03_update_module.sh index 4458c20..3d28737 100755 --- a/scripts/03_update_module.sh +++ b/scripts/03_update_module.sh @@ -7,7 +7,7 @@ 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 +for path in $(find "$(get_scope $1)" -name 'monitors-*.tf' -print | sort -fdbi); do cd $(dirname $path) # get name of the monitors set directory resource="$(basename $(dirname $path))" diff --git a/scripts/90_best_practices.sh b/scripts/90_best_practices.sh index 12be77b..a44afb5 100755 --- a/scripts/90_best_practices.sh +++ b/scripts/90_best_practices.sh @@ -5,7 +5,7 @@ source "$(dirname $0)/utils.sh" goto_root # loop over every monitors set -for path in $(find "$(get_scope $1)" -path ./incubator -prune -o -name 'monitors-*.tf' -print | sort -fdbi); do +for path in $(find "$(get_scope $1)" -name 'monitors-*.tf' -print | sort -fdbi); do # check if there is more than 1 notify_no_data parameter set to true per set of monitors if [[ $(grep -c notify_no_data.*true $path) -gt 1 ]]; then echo "More than one notify_no_data set to true on $path" diff --git a/scripts/99_terraform.sh b/scripts/99_terraform.sh index eb54644..346c9e1 100755 --- a/scripts/99_terraform.sh +++ b/scripts/99_terraform.sh @@ -4,7 +4,7 @@ set -xueo pipefail source "$(dirname $0)/utils.sh" goto_root -for path in $(find "$(get_scope $1)" -path ./testing -prune -o -path ./incubator -prune -o -name 'inputs.tf' -print); do +for path in $(find "$(get_scope $1)" -name 'inputs.tf' -print); do dir=$(dirname ${path}) terraform init ${dir} >> /dev/null 2>&1 terraform validate -check-variables=false ${dir} diff --git a/testing/dummy/dummy.tf b/testing/dummy/dummy.tf deleted file mode 100644 index 3a08ce1..0000000 --- a/testing/dummy/dummy.tf +++ /dev/null @@ -1,3 +0,0 @@ -resource "null_resource" "test-migration" { -} - diff --git a/testing/dummy/versions.tf b/testing/dummy/versions.tf deleted file mode 100644 index ac97c6a..0000000 --- a/testing/dummy/versions.tf +++ /dev/null @@ -1,4 +0,0 @@ - -terraform { - required_version = ">= 0.12" -} diff --git a/testing/inputs.tf b/testing/inputs.tf deleted file mode 100644 index 2cff9ea..0000000 --- a/testing/inputs.tf +++ /dev/null @@ -1,22 +0,0 @@ -variable environment {} - -variable region {} - -variable "critical_escalation_group" { - default = "@pagerduty_HODummy" -} - -variable "warning_escalation_group" { - default = "@pagerduty_HNODummy" -} - -variable "datadog_api_key" {} -variable "datadog_app_key" {} - -variable "dd_system" { - default = "enabled" -} - -variable "dd_aws_rds" { - default = "enabled" -} diff --git a/testing/main.tf b/testing/main.tf deleted file mode 100644 index 96b9614..0000000 --- a/testing/main.tf +++ /dev/null @@ -1,4 +0,0 @@ -provider "datadog" { - api_key = "${var.datadog_api_key}" - app_key = "${var.datadog_app_key}" -} diff --git a/testing/modules.tf b/testing/modules.tf deleted file mode 100644 index 0e2907d..0000000 --- a/testing/modules.tf +++ /dev/null @@ -1,12 +0,0 @@ -module "datadog-monitors" { - source = "git::ssh://git@bitbucket.org/morea/terraform.feature.datadog.git" - - env = "${var.environment}" - region = "${var.region}" - - critical_escalation_group = "${var.critical_escalation_group}" - warning_escalation_group = "${var.warning_escalation_group}" - - dd_aws_rds = "${var.dd_aws_rds}" - dd_system = "${var.dd_system}" -}