Upload tools

This commit is contained in:
Clement Chiew
2023-11-02 23:27:08 +08:00
parent e080445591
commit 709902b4b8
3 changed files with 130 additions and 0 deletions

24
trefresh Executable file
View File

@ -0,0 +1,24 @@
#!/bin/bash
set -e
# Pick tfvars file
TFVAR_COUNT=$( find . -type f -name "*.tfvars" | wc -l )
if (( TFVAR_COUNT <= 0 )); then
printf "No tfvars file found.\n"
exit 1
fi
printf "${TFVAR_COUNT} tfvar files found. Pick the number.\n"
FILELIST_OUTPUT=$(find . -type f -name "*.tfvars")
printf "${FILELIST_OUTPUT}\n" | nl
read -p "Pick file number (1): " TFVAR_PICK
if (( TFVAR_PICK > 0 )) && (( TFVAR_PICK <= TFVAR_COUNT )); then
:
else
printf "Pick is invalid\n" && exit 1
fi
# Get picked file
TFVAR_PICK_FILE=$( printf "${FILELIST_OUTPUT}\n" | head -n "${TFVAR_PICK}" | tail -1 )
terraform plan -refresh-only -var-file="${TFVAR_PICK_FILE}"