mirror of
https://github.com/Loofort/terraform-aws-gitea
synced 2024-05-08 23:16:06 +02:00
15 lines
579 B
Bash
Executable File
15 lines
579 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -euxo pipefail
|
|
|
|
#ip=$(terraform output -json | jq -r '.public_ip.value')
|
|
#terraform output -json | jq -r '.private_key.value' > key.pem
|
|
ip=$(terraform state show aws_instance.host | grep "public_ip " | sed 's/public_ip *= //')
|
|
terraform state show tls_private_key.key | perl -ne 'BEGIN{undef $/;} /(-----BEGIN RSA PRIVATE.*?PRIVATE KEY-----)/s and print "$1"' > key.pem
|
|
|
|
chmod 400 key.pem
|
|
ssh -i key.pem -oStrictHostKeyChecking=no ec2-user@$ip
|
|
rm -f key.pem
|
|
|
|
# generate key manually
|
|
# ssh-keygen -t rsa -b 4096 -C "skarbdev@gmail.com" -f sshkey -q -N "" |