terra-farm / terraform-provider-virtualbox

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

Provisioner "remote-exec/file" seems not working #29

Closed DblK closed 6 years ago

DblK commented 6 years ago

When I add provisioner section like:

provisioner "file" {
    source      = "scripts/test.sh"
    destination = "/tmp/script.sh"
  }
  provisioner "remote-exec" {
    inline = [
      "chmod +x /tmp/script.sh",
      "/tmp/script.sh args",
    ]
  }

The node is provisionned but it failed with error:

Error: Error applying plan:

1 error(s) occurred:

* virtualbox_vm.node: timeout - last error: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain

The script is not executed.. If I comment my code the node is well provisioned with no error.

DblK commented 6 years ago

Sorry, this is not an issue, I forgot to put

  connection {
    type     = "ssh"
    user     = "vagrant"
    password = "vagrant"
    timeout  = "30s"
  }

Inside the resource bloc to be able to run provisioner "remote-exec" and provisioner "file".