我正在与provider.azurerm v2.2.0一起使用Terraform v0.12.24。当我尝试创建缩放集虚拟机时,我会收到以下错误:
错误:计算。VirtualMachineScaleSetsClient#CreateOrUpdate:失败发送请求:StatusCode=400--原始错误:Code="InvalidParameter">Message="参数的值linuxConfiguration.sh.publicKeys.path无效。"Target="linuxConfiguration.ssh.publicKeys.path">
在scaleset.tf第1行,在资源中"azurerm_virtual_machine_scale_set"demo":1:资源"azurerm_virtual_machine_scale_set"演示"{
我使用Windows 10进行地形配置。我的os_profile_linux_config如下:
storage_profile_image_reference {
publisher = "Canonical"
offer = "UbuntuServer"
sku = "18.04-LTS"
version = "latest"
}
os_profile_linux_config {
disable_password_authentication = true
ssh_keys {
key_data = file("C:/Users/jack/Documents/key/id_rsa.pub")
path = "C:/Users/jack/Documents/key"
}
}
首先,我试过两对不同的钥匙。一个由puttygen创建,另一个由ssh-keygen使用git-bash创建。我对他们俩都犯了同样的错误。你知道吗?
对于您的问题,我认为您误解了ssh_key的属性path
,它显示在这里:
ssh_keys-(可选(指定路径和key_data的集合被放置在虚拟机上。
这是要创建的VM内部的路径,而不是执行Terraform的机器的路径。还有:
注意:请注意,唯一允许的路径是/home//.ssh/authorized_keys由于Azure的限制。