clan-infra/targets/admins/tf.sh

19 lines
377 B
Bash
Raw Normal View History

2023-07-04 15:23:29 +00:00
#!/usr/bin/env bash
set -euo pipefail
rm -f .terraform.lock.hcl
if grep -q .sops terraform.tfstate; then
sops -i -d terraform.tfstate
2023-07-17 08:31:59 +00:00
fi
if [[ -f secrets.auto.tfvars.sops.json ]]; then
sops -d secrets.auto.tfvars.sops.json > secrets.auto.tfvars.json
2023-07-04 15:23:29 +00:00
fi
cleanup() {
2023-07-13 16:37:14 +00:00
rm -f secrets.auto.tfvars.json
2023-07-04 15:23:29 +00:00
sops -i -e terraform.tfstate
}
2023-07-13 15:47:35 +00:00
2023-07-04 15:23:29 +00:00
trap "cleanup" EXIT
2024-03-12 10:28:00 +00:00
tofu init
tofu "$@"