hscloud/cluster/tools/nixops.sh
Sergiusz Bazanski 96c428f7d7 nixops: fix
Change-Id: I15ebde319fcae3f9771da6a549e52783e0ec4409
2019-11-17 19:00:46 +01:00

22 lines
570 B
Bash
Executable file

#!/usr/bin/env bash
# A wrapper around real nixops to decrypt GCP secret.
if [ -z "$hscloud_root" ]; then
echo 2>&1 "Please source env.sh"
exit 1
fi
for f in sa.json sa.pem; do
plain="$hscloud_root/gcp/secrets/plain/$f"
cipher="$hscloud_root/gcp/secrets/cipher/$f"
if [ ! -f "$plain" ]; then
secretstore decrypt "$cipher" > "$plain"
fi
done
export GCE_PROJECT="hscloud"
export GCE_SERVICE_ACCOUNT="nixops@hscloud.iam.gserviceaccount.com"
export ACCESS_KEYPATH="$hscloud_root/gcp/secrets/plain/sa.pem"
./external/nixops/bin/nixops "$@"