Search code examples
azureterraformazure-rm

Terraform WinRM issue after server joins domain


I am having an issue with a Terraform provisioner using a WinRM connection to connect to a Windows Azure server. Here is my TF code.

connection {
  type = "winrm"
  user = ".\\admin"
  password = var.password
  host = var.ip_address
  timeout = "5m"
  port = 5985
  use_ntlm = true
  https = false
  insecure = true
}

When I first run this on a brand new server, it connects without issue. However, once I join the server to the domain, it no longer works. It will just continue trying to connect until it eventually times out.

I have tried "domain\user" as well as local user accounts. I have tried IP address vs FQDN. I have turned off UAC and made a change to a registry entry from other docs I have read. I have enabled all WinRM auths for client and service and have set to allow unencrypted. Finally, I have enabled PS-Remoting and opened the ports in the firewall.

Does anyone know what else can be done to get this to work?


Solution

  • Looks like the issue was NTLM. It was not using the domain that I was providing with the user name. Setting it to false fixed the issue.