MON-273 add script to auto add filter tag module
This commit is contained in:
parent
faeb0d13bb
commit
5b457cc505
24
scripts/03_update_module.sh
Executable file
24
scripts/03_update_module.sh
Executable file
@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -xueo pipefail
|
||||||
|
|
||||||
|
source "$(dirname $0)/utils.sh"
|
||||||
|
goto_root
|
||||||
|
|
||||||
|
for path in $(find "$(get_scope $1)" -path ./incubator -prune -o -name 'monitors-*.tf' -print); do
|
||||||
|
cd $(dirname $path)
|
||||||
|
resource="$(basename $(dirname $path))"
|
||||||
|
if ! [ -f modules.tf ] && grep -q filter_tags_use_defaults inputs.tf; then
|
||||||
|
cat > modules.tf <<EOF
|
||||||
|
module "filter-tags" {
|
||||||
|
source = "../../common/filter-tags"
|
||||||
|
|
||||||
|
environment = "\${var.environment}"
|
||||||
|
resource = "$resource"
|
||||||
|
filter_tags_use_defaults = "\${var.filter_tags_use_defaults}"
|
||||||
|
filter_tags_custom = "\${var.filter_tags_custom}"
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
cd - >> /dev/null
|
||||||
|
done
|
||||||
|
terraform fmt "$(get_scope $1)"
|
||||||
Loading…
x
Reference in New Issue
Block a user