Replies: 3 comments 1 reply
|
There is no functionality out of the box that I'm aware of that can do this. One way of doing this is to pre-generate the keypair and then somehow putting that key into your instance (maybe via cloud-init or some other method). For the SSH approach you don't want to take because of the chicken-and-egg problem I believe you should be able to do this with a local-exec provisioner in combination with ssh-keyscan. It's very difficult to have a concrete answer here without knowing a lot about what kind of resources you're deploying. |
1 reply
|
Good luck! |
0 replies
|
I made a small module which helps with this problem at least a bit.
All in all, ugly as hell. And requires python+ssh on the runner. But well, #worksonmymachine, maybe it's useful for someone else. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Is there a mechanism in opentofu that extracts the SSH Public Key from a newly created machine (via provider, not through SSH, which would be a chicken-and-egg problem) and puts it into the user's
.ssh/known_hostsfile?All reactions