terra-farm / terraform-provider-virtualbox

VirtualBox provider for Terraform
https://terra-farm.github.io/provider-virtualbox/
MIT License
324 stars 136 forks source link

Resource for ssh key logins. #56

Closed icarusfactor closed 5 years ago

icarusfactor commented 5 years ago

I'm new to Terraform, glad to have a virtualbox provider for testing. It all installed it just fine,only issue was having to change the Virtualbox instances to nat from bridged on Debian host. But having the two example nodes installed ,how can I import my ssh keys to each of these nodes so I can log into them? This is not the vagrant version,just the Ubuntu version provided. Also, I would also like to create my own image to use with Terraform and would like to know the syntax for adding my keys into the tf file.

VoyTechnology commented 5 years ago

You would typically provide the ssh keys as user_data. I have not done it myself, but you would need cloudinit and pass in the config file - https://cloudinit.readthedocs.io/en/latest/topics/examples.html

icarusfactor commented 5 years ago

Thanks! That's excellent that I can use cloudinit with terraform, I'm a user of Cloudinit with Openstack.

icarusfactor commented 5 years ago

From your answer I am now just figuring out that I can have multiple tf files with multiple providers in the directory. Having one for virtualbox and one for cloudinit or even more for doing even more configurations. That is what I was after thanks.