Files
nomad/enos/debug-environment
Tim Gross 6ae1444cf4 upgrade testing: debugging assistance (#25232)
Enos buries the Terraform output from provisioning. Add a shell script to load
the environment from provisioning for debugging Nomad during development of
upgrade tests.
2025-02-27 08:35:45 -05:00

29 lines
626 B
Bash
Executable File

#!/usr/bin/env bash
set -eu
help() {
cat <<'EOF'
Export a set of environment variables so you can debug Nomad while running it
under this Enos scenario.
Usage: $(debug-environment .enos/[directory with Enos state])
EOF
}
DIR=${1:-unknown}
if [[ $DIR == "unknown" ]]; then
help
exit 1
fi
pushd $DIR > /dev/null
cat <<EOF
export NOMAD_TOKEN=$(terraform output --raw nomad_token)
export NOMAD_ADDR=$(terraform output --raw nomad_addr)
export NOMAD_CACERT=$(terraform output --raw ca_file)
export NOMAD_CLIENT_CERT=$(terraform output --raw cert_file)
export NOMAD_CLIENT_KEY=$(terraform output --raw key_file)
EOF