Comments (4)
Hey there. Seems like there is trouble reaching the machine. Can you ping or reach the machine with ssh from your computer?
Does it work if you destroy the resource with terraform destroy
and run terraform apply
again?
from terraform-examples.
Ah, sorry. On second look, I missed the
ssh: handshake failed
So forget my previous question 🙄 . The problem is that you do not have the SSH private key in your ssh agent or otherwise do not give the identity to ssh.
One way of doing it (and this is totally missing in the example, I just saw) is to add your key to your SSH agent.
This is easy, just run
$ ssh-add ~/.ssh/id_rsa
whereas ~/.ssh/id_rsa
is the path to your private SSH key (it really can be named anything). You can check if the key is loaded by again running ssh-add with -L, e.g.:
$ ssh-add -L
ssh-ed25519 AAAAC3NzaC1lZDI1NTE <snip/> 9ZwXl [email protected]
If it shows you something here it has the key loaded and ssh will consider that key when connecting to servers.
There are other ways to achieve the same thing but I find using SSH agents more convenient. The line where you can change SSH connection options is this in server.tf example.
Let me know if this works!
from terraform-examples.
@bkircher thanks for the input. I will work on it and get back to you :)
from terraform-examples.
@bkircher I tried using ssh-add and it works absolutely fine. But, I was trying to execute this inside an alpine image container with minimal resources supported on shell. I tried with too many ways of using a local provisioner to add ssh key but the agent tries to open a connection and fails. Hence it is better or easy to point your private key inside the connection details. I can provide you an example and you may also include this in the document.
connection { user = "root" port = 22 private_key = file("/root/.ssh/id_rsa") host = gridscale_ipv4.ipv4_address.ip timeout = "2m" }
Maybe this will be useful if someone tries to build CI/CD using k8s agent on Jenkins or Gitlab runners.
from terraform-examples.
Related Issues (6)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from terraform-examples.