terra-farm / terraform-provider-virtualbox

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

How to specify login credentials #26

Closed mjbright closed 2 years ago

mjbright commented 6 years ago

It would be useful to document how to specify login credentials.

I've booted a couple of nodes using the example.tf but don't know how to specify login credentials or login with the example box.

I tried adding a connection construct within the resource without success.

Is this possible with this provider or are we obliged to prepare the box/image in advance with known credentials?

  connection {
      type     = "ssh"

      #user     = "root"
      #password = "${var.root_password}"

      user     = "ubuntu"
      password = "test1234"
      host_key = "${file("/home/mjb/.ssh/id_rsa.pub")}"
      public_key = "${file("/home/mjb/.ssh/id_rsa.pub")}"
  }
ringods commented 6 years ago

@mjbright most base boxes are built with Packer and use the standard Vagrant insecure ssh keypair. You can find the keypair here:

https://github.com/hashicorp/vagrant/tree/master/keys

mjbright commented 6 years ago

Thanks for the info, I didn't know about that keypair.

After a few unsuccessful attempts (logging in as root or ubuntu) I realized I should try vagrant user.

I think it's worth documenting that insecure keypair and how to use it.

Would be nice to be able to provide another keypair of course.

Anyway, I've got what I needed thanks a lot!

On 4 April 2018 at 19:52, Ringo De Smet notifications@github.com wrote:

@mjbright https://github.com/mjbright most base boxes are built with Packer and use the standard Vagrant insecure ssh keypair. You can find the keypair here:

https://github.com/hashicorp/vagrant/tree/master/keys

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/terra-farm/terraform-provider-virtualbox/issues/26#issuecomment-378688237, or mute the thread https://github.com/notifications/unsubscribe-auth/ABywLRdb51VXIQlqgN22e-gHjK6MQXnxks5tlQhNgaJpZM4THM-i .

ringods commented 6 years ago

@mjbright I'll make note of documenting about this insecure keypair. But since a keypair is something linked to the box you are using, it is difficult to document this universally.

zBrainiac commented 6 years ago

Hi all first of all I like to thanks you very much for all the work you do! Is in the meantime a updated documentation available?

jaredbrogan commented 2 years ago

+1 on this request

VoyTechnology commented 2 years ago

Looking back, it does seem like the comment was added about the insecure key - https://github.com/terra-farm/terraform-provider-virtualbox/commit/1d963062fe46314fa5e414fd2aa4daa9245da563.

Seeing how the use of provisioners is now discouraged, I don't think adding more documentation on how to establish a SSH connection is necessary.