Feat/separate functions (#19)
* chore: work save * fix: refactor flavors * fix: refactor pg user and database * fix: refactor flavor parameters * fix: refactor tf script * chore: work save * chore: work save * chore: work save --------- Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
This commit is contained in:
parent
910551f09d
commit
0150fea302
54 changed files with 6010 additions and 2826 deletions
58
sample/tf.sh
58
sample/tf.sh
|
|
@ -3,28 +3,44 @@
|
|||
|
||||
# ./tf.sh apply > >(tee -a stdout.log) 2> >(tee -a stderr.log >&2)
|
||||
|
||||
# copy or rename sample.tfrc.example and adjust it
|
||||
TERRAFORM_CONFIG=$(pwd)/sample.tfrc
|
||||
export TERRAFORM_CONFIG
|
||||
usage() {
|
||||
echo "$0 usage:" && grep "[[:space:]].)\ #" "$0" | sed 's/#//' | sed -r 's/([a-z])\)/-\1/';
|
||||
exit 0;
|
||||
}
|
||||
|
||||
parsed_options=$(
|
||||
getopt -n "$0" -o dil -- "$@"
|
||||
) || exit
|
||||
eval "set -- $parsed_options"
|
||||
while [ "$#" -gt 0 ]; do
|
||||
case $1 in
|
||||
(-d) TF_LOG=DEBUG
|
||||
export TF_LOG
|
||||
shift;;
|
||||
(-i) TF_LOG=INFO
|
||||
export TF_LOG
|
||||
shift;;
|
||||
(-t) TF_LOG=TRACE
|
||||
export TF_LOG
|
||||
shift;;
|
||||
(--) shift; break;;
|
||||
(*) echo "Unknown option ${1}" # should never be reached.
|
||||
[ $# -eq 0 ] && usage
|
||||
|
||||
CONFIG_FOLDER=$(dirname "$0")
|
||||
BINARY=terraform
|
||||
|
||||
while getopts ":b:hdit" arg; do
|
||||
case $arg in
|
||||
b) # Set binary (default is terraform).
|
||||
BINARY=${OPTARG}
|
||||
shift 2
|
||||
;;
|
||||
d) # Set log level to DEBUG.
|
||||
TF_LOG=DEBUG
|
||||
export TF_LOG
|
||||
shift
|
||||
;;
|
||||
i) # Set log level to INFO.
|
||||
TF_LOG=INFO
|
||||
export TF_LOG
|
||||
shift
|
||||
;;
|
||||
t) # Set log level to TRACE.
|
||||
TF_LOG=TRACE
|
||||
export TF_LOG
|
||||
shift
|
||||
;;
|
||||
h | *) # Display help.
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
terraform "$*"
|
||||
TERRAFORM_CONFIG=${CONFIG_FOLDER}/config.tfrc
|
||||
export TERRAFORM_CONFIG
|
||||
|
||||
${BINARY} "$@"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue