Refactored scripts to focues on compatibility with the real product.
This commit is contained in:
26
test/init.sh
26
test/init.sh
@@ -1,3 +1,27 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
terraform init -backend-config backend.config
|
||||
ACCESS_KEY=""
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--key|-k)
|
||||
if [[ ! -f "../accounts.env" ]]; then
|
||||
echo "Error: accounts.env file not found at ../accounts.env" >&2
|
||||
exit 1
|
||||
fi
|
||||
# Load the accounts.env file to get the ACCESS_KEY variable.
|
||||
source "../accounts.env"
|
||||
ACCESS_KEY=$(echo "$AZURITE_ACCOUNTS" | cut -f 1 -d ';' | cut -f 2 -d ':')
|
||||
;;
|
||||
*)
|
||||
echo "Unknown argument: $1"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if [[ -z "$ACCESS_KEY" ]]; then
|
||||
terraform init -backend-config="backend.config" -backend-config="use_azuread_auth=true" -reconfigure
|
||||
else
|
||||
terraform init -backend-config="backend.config" -backend-config="access_key=$ACCESS_KEY" -reconfigure
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user