【发布时间】:2021-03-04 06:45:52
【问题描述】:
创建 VM 后,我正在使用 terraform 配置文件和 remote-exec 安装 google chrome。但是在运行 terraform apply 时会出错。我还启用了 nsg 规则以允许所有端口。我不确定该错误是否与 nsg 规则有关。
Error: timeout - last error: unknown error Post "https://10.0.2.4:5986/wsman": dial tcp 10.0.2.4:5986: connectex: A connection attempt failed because the connected party did not properly respond after a
period of time, or established connection failed because connected host has failed to respond.
resource "azurerm_virtual_machine" "myterraformvm" {
name = "Test-01"
location = "East Us"
resource_group_name = data.azurerm_resource_group.test.name
network_interface_ids = ["${azurerm_network_interface.main.id}"]
vm_size = "Standard_DS1_v2"
storage_os_disk {
name = "${azurerm_managed_disk.copy.name}"
os_type = "Windows"
managed_disk_id = "${azurerm_managed_disk.copy.id}"
create_option = "Attach"
}
provisioner "file" {
source = "./google_chrome_install.ps1"
destination = "C:/"
connection {
host = "${azurerm_network_interface.main.private_ip_address}"
type = "winrm"
https = true
port = 5986
use_ntlm = true
insecure = true
user = "testadmin"
password = "*******"
}
}
provisioner "remote-exec" {
connection {
host = "${azurerm_network_interface.main.private_ip_address}"
type = "winrm"
https = true
port = 5986
use_ntlm = true
insecure = true
user = "testadmin"
password = "***"
}
inline = [
"powershell -ExecutionPolicy Unrestricted -File C:/google_chrome_install.ps1 -Schedule"
]
}
}
【问题讨论】:
-
您是否与
5986上的10.0.2.4实例建立了连接?您如何路由到该私有 IP 地址? -
您也使用 https 获取 IP。猜猜应该是http。
标签: terraform