【发布时间】:2020-01-24 07:25:38
【问题描述】:
我正在尝试使用 terraform 在 Azure 中创建一个 VM,并将文件从本地计算机复制到 azure 上的远程虚拟机。
os_profile {
computer_name = "pdemo"
admin_username = "ubuntu"
}
os_profile_linux_config {
disable_password_authentication = true
ssh_keys {
key_data = "ssh-rsa ********************************** "
path = "/home/ubuntu/.ssh/authorized_keys"
}
}
provisioner "file" {
connection {
type = "ssh"
user = "ubuntu"
host = azurerm_public_ip.terraform-PUBLIC-IP.ip_address
private_key = file("/home/ubuntu/.ssh/id_rsa")
}
source = "/home/ubuntu/.ssh/terraform.pub"
destination = "/home/ubuntu/.ssh/terraform.pub"
}
}
它给出了一个错误:
azurerm_virtual_machine.terraform-app-VM: Still creating... [1m30s elapsed]
azurerm_virtual_machine.terraform-app-VM: Still creating... [1m40s elapsed]
azurerm_virtual_machine.terraform-app-VM: Still creating... [6m20s elapsed]
azurerm_virtual_machine.terraform-app-VM: Still creating... [6m30s elapsed]
Error: timeout - last error: SSH authentication failed (ubuntu@:22): ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain
【问题讨论】: