Closed ericb-summit closed 3 years ago
I don't have an AD server in my home lab. It will be difficult for me to reproduce the issue, so it can be fixed. Do you know enough about Go to create a PR?
If you explain to me how to build this locally and use it locally I can probably give it a stab.
I have the base go tools, compiler etc installed. I'm just not sure how to use a locally compiled provider in terraform.
Ok, I figured it out. Code from this PR tested OK in my use case. As you see the change is near trivial.
PR https://github.com/josenk/terraform-provider-esxi/pull/144
Merged. Thanks for the contribution. Sorry it took so long to get done.
Describe the bug
Generally speaking, this provider does not work when using active directory credentials, for a number of reasons.
1) When logging in through AD, the user is of format DOMAIN\user. Also, the user does not actually exist until you log in, and so elements such as the home directory don't exist.
The SSH component of the provider assumes no possible errors could come as part of login. However, when logging in via ssh using an active directory account, you get this output:
Thie erorr message "Could not chdir, ..." makes its way into various variables in the provider, and obviously blows up.
This is easily overcome using a remote-exec provisioner to create the home directory
2) The username in the vi:// path passed to ovtool needs to be URL encoded. So like, DOMAIN\User needs to become DOMAIN%5cUser when creating the vi:// URL passed to ovftool.