PortOfPortland / terraform-provider-windns

A Terraform provider for Microsoft Windows DNS
MIT License
39 stars 20 forks source link

Terraform Apply Hangs #13

Closed MaxAnderson95 closed 3 years ago

MaxAnderson95 commented 4 years ago

Below is my configuration:

main.tf:

provider "windns" {
  server = "dc01.example.org"
  username = "_manderson"
  password = "{redacted}"
  usessl = true
}

resource "windns" "dns" {
  record_name = "testentry1"
  record_type = "A"
  zone_name = "example.org"
  ipv4address = "192.168.1.5"
}

Terraform Version: v.13.0 (also tried v0.12.29) windns: v0.5.1

When running terraform apply the system will hang and print "still creating..." every 10 seconds until I manually stop the process. When I enable warning logs, I notice errors related to rpc.

~\Code\Terraform\test2> terraform apply -auto-approve
2020-08-16T20:42:55.220-0400 [WARN]  plugin.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = transport is closing"
2020-08-16T20:42:55.560-0400 [WARN]  plugin.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = transport is closing"
2020-08-16T20:42:55.898-0400 [WARN]  plugin.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = transport is closing"
windns.dns: Creating...
windns.dns: Still creating... [10s elapsed]
windns.dns: Still creating... [20s elapsed]
windns.dns: Still creating... [30s elapsed]
windns.dns: Still creating... [40s elapsed]
windns.dns: Still creating... [50s elapsed]

I've ensured that I'm able to connect to the domain controller using the credentials provided by running: New-PSSesssion -ComputerName dc01.example.org -Credential (Get-Credential) -UseSSL

Any ideas on what might be the cause?

rayterrill commented 4 years ago

@MaxAnderson95 can you try it with usessl = "1" instead of true? I might need to fix this in the underlying code + goPSRemoting module that's used - we swapped over to using SSH, so it's been a while since I tested this with WinRM, but just looking at the code and my example, it might need to be usessl = "1" vs usessl = true.

MaxAnderson95 commented 4 years ago

@rayterrill Thanks for the suggestion, but that unfortunately did not produce any change in behavior.

rayterrill commented 4 years ago

You could try running Terraform in DEBUG mode to see if it gives any better errors.

We swapped over to SSH for similar reasons - we kept running into auth errors from Linux to Windows, and it mostly "just works" with SSH (no Transport errors). Microsoft also had been pushing people to SSH for cross-platform connectivity in many of the bugs raised for WinRM issues.

I'll try to set up another test environment for this - but currently I don't have a WinRM Linux to Windows environment available.

MATTHEWTAYLOR1995 commented 3 years ago

Hello all,

I'm also getting the same issue, Windns creates the record successfully but hangs within the TF apply. I've tried both SSH and SSL and I get the same result.

I've turned debugging on and couldn't see any useful logs,

Did anyone find a solution?

FIA

IanMoroney commented 3 years ago

I am also encountering this issue and unable to progress with using the provider. I am able to perform a new-pssession with the credentials i'm using, and winrm is set up correctly with the certificate responding to the same hostname i'm targeting through terraform.

rayterrill commented 3 years ago

Are y'all running this on Windows? Can you try it out with the v0.5.2 build I just uploaded to Github (https://github.com/PortOfPortland/terraform-provider-windns/releases/tag/v0.5.2)? There was a bug in the tempfile implementation on Windows that was causing some hangs.

rayterrill commented 3 years ago

This should likely be resolved with the v0.5.3 build.