【发布时间】:2021-01-18 10:55:17
【问题描述】:
我正在尝试在 Windows VM 上使用 terraform 在配置器下运行
provisioner "remote-exec" {
connection {
type = "winrm"
user = "${local.admin_username}"
password = "${local.admin_password}"
port = 5986
https = true
timeout = "10m"
host = azurerm_public_ip.example.ip_address
insecure = true
}
inline = [
"powershell.exe New-Item -Path c:\\ -Name testfile1.txt -ItemType file -Value This is a text string."
]
}
在配置 VM 时,我在尝试使用 remote-exec 建立连接时遇到错误
azurerm_virtual_machine.example (remote-exec): Connecting to remote host via WinRM...
azurerm_virtual_machine.example (remote-exec): Host: 52.172.xxx.xxx
azurerm_virtual_machine.example (remote-exec): Port: 5986
azurerm_virtual_machine.example (remote-exec): User: testadmin
azurerm_virtual_machine.example (remote-exec): Password: true
azurerm_virtual_machine.example (remote-exec): HTTPS: true
azurerm_virtual_machine.example (remote-exec): Insecure: true
azurerm_virtual_machine.example (remote-exec): NTLM: false
azurerm_virtual_machine.example (remote-exec): CACert: false
azurerm_virtual_machine.example: Still creating... [11m50s elapsed]
azurerm_virtual_machine.example: Still creating... [12m0s elapsed]
Error: timeout - last error: unknown error Post "https://52.172.xxx.xxx:5986/wsman": dial tcp 52.172.xxx.xxx: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.
provisioner 是否以正确的格式提供?
【问题讨论】:
-
您是否在 Windows 主机上启用/配置了 WinRM 和 ICF(防火墙)?默认情况下,WinRM 服务已安装并正在运行,但未配置任何侦听器,而且 Windows 防火墙将阻止与 WinRM 端口的连接。
标签: azure terraform terraform-provider-azure