Hi,
I have tried switching on debug during a terraform apply, and I can see a whole bunch of :-
dial tcp :22: connectex: No connection could be made because the target machine actively refused it.
specifically ...
2018-01-26T09:56:34.043Z [DEBUG] plugin.terraform.exe: file-provisioner (internal) 2018/01/26 09:56:34 Retryable error: dial tcp :22: connectex: No connection could be made because the target machine actively refused it.
error messages during the run while it's still saying "Still creating..." for the VM.
If I try to ssh to the VM as the correct user during this run, it works fine (even at the same time these errors are put into the logs) so I suspect the file-provisioner is not using the correct ssh keys, or something similar. Here's my os_profile_config
os_profile_linux_config {
disable_password_authentication = true
ssh_keys {
path = "/home/adminusername/.ssh/authorized_keys"
key_data = "${var.ssh_key}"
}
}
I have tried scouring the docs, and googling for the error message and searching through these forums but nothing comes up.
Here's the provisioner that's failing.
provisioner "file" {
source = "setup_elasticsearch.sh"
destination = "/home/adminuser/setup_elasticsearch.sh"
connection {
type = "ssh"
host = "${azurerm_public_ip.elastic_uk.ip_address}"
user = "adminuser"
private_key = "${file("~/.ssh/id_rsa")}"
agent = "false"
timeout = "1m"
}
}
The ssh key looks OK, permissions are 700 for the .ssh directory and 600 for the authorized_keys file and like I said above, I can ssh on myself using the same key.
Have I come across a bug in the Azurerm provisioner?
Can anyone suggest something more to try?
Many thanks,
Steve Button