terraform-provider-stackitp.../sample/tf.sh
Marcel_Henselin 8fee76f037
All checks were successful
Publish / Check GoReleaser config (push) Successful in 4s
Publish / Publish provider (push) Successful in 13m40s
fix: postgresqlflex flavor errors (#107)
feat: enable old v2 flavor handling
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Reviewed-on: #107
2026-05-07 05:38:11 +00:00

52 lines
947 B
Bash
Executable file

#!/usr/bin/env bash
# ./tf.sh apply > >(tee -a stdout.log) 2> >(tee -a stderr.log >&2)
usage() {
echo "$0 usage:" && grep "[[:space:]].)\ #" "$0" | sed 's/#//' | sed -r 's/([a-z])\)/-\1/';
exit 0;
}
[ $# -eq 0 ] && usage
CONFIG_FOLDER=$(dirname "$0")
# BINARY=terraform
BINARY=tofu
ADD=""
while getopts ":b:hdirt" 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
;;
r) # Set log level to INFO.
ADD="-refresh-only"
shift
;;
t) # Set log level to TRACE.
TF_LOG=TRACE
export TF_LOG
shift
;;
h | *) # Display help.
usage
;;
esac
done
TERRAFORM_CONFIG=${CONFIG_FOLDER}/config.tfrc
export TERRAFORM_CONFIG
${BINARY} "$@" ${ADD}