clan-infra/targets/admins/tf.sh
Jörg Thalheim 9204ad948d
All checks were successful
build / test (push) Successful in 7s
switch from netlify to hetznerdns
2023-07-13 18:38:20 +02:00

19 lines
393 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
if [[ -f secrets.auto.tfvars.sops.json ]]; then
sops -d secrets.auto.tfvars.sops.json > secrets.auto.tfvars.json
fi
fi
cleanup() {
rm -f secrets.auto.tfvars.json
sops -i -e terraform.tfstate
}
trap "cleanup" EXIT
terraform init
terraform "$@"