Skip to content

Instantly share code, notes, and snippets.

@maliciousgroup
Created April 8, 2021 22:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maliciousgroup/11f8b30bca43b909cf6a47a4746ae876 to your computer and use it in GitHub Desktop.
Save maliciousgroup/11f8b30bca43b909cf6a47a4746ae876 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# shellcheck disable=SC2046
# shellcheck disable=SC2164
SCRIPT_PATH="$(cd $(dirname "$0") > /dev/null 2>&1; pwd -P)"
if test -f "${SCRIPT_PATH}"/terraform_rsa; then
echo "[Warning] Keys seem to already exist. Skipping key generation"
exit
fi
if ! ssh-keygen -b 4096 -t rsa -f "${SCRIPT_PATH}"/terraform_rsa -q -N ""; then
echo "[Error] There was an error generating the SSH key for Terraform"
exit
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment