clan-infra/targets/admins/tf.sh
Jörg Thalheim cbc7de9d07
All checks were successful
build / test (push) Successful in 13s
add new baremetal server
2023-07-18 16:21:31 +02:00

19 lines
387 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
rm -f .terraform.lock.hcl
if grep -q .sops terraform.tfstate; then
sops -i -d terraform.tfstate
fi
if [[ -f secrets.auto.tfvars.sops.json ]]; then
sops -d secrets.auto.tfvars.sops.json > secrets.auto.tfvars.json
fi
cleanup() {
rm -f secrets.auto.tfvars.json
sops -i -e terraform.tfstate
}
trap "cleanup" EXIT
terraform init
terraform "$@"