elsudano / terraform-provider-vmworkstation

VmWare Workstation Pro provider for Terraform
MIT License
51 stars 18 forks source link

Windows Version? What versions are native? #3

Closed pixelrebirth closed 3 years ago

pixelrebirth commented 3 years ago

Id love to be able to use this on my windows client... but it doesnt seem to have been built for that platform. Seems like a pretty easy fix to implement using go to build it. Id like to see this be a native functionality though so I dont have to manage a custom build version of this myself.

Thoughts?

Initializing the backend...

Initializing provider plugins...
- Finding latest version of elsudano/vmworkstation...

Error: Incompatible provider version

Provider registry.terraform.io/elsudano/vmworkstation v0.1.7 does not have a
package available for your current platform, windows_amd64.
elsudano commented 3 years ago

Hi pixelrebirth Firsly thanks for try use my provider

Secondly if you want try to develop that for Windows would amaizing

Maybe you can try clone my repo https://github.com/elsudano/vmware-workstation-api-client And create a MR and after I will try to implement the Windows part un the provider

Let me know that you think about that

Regards

pixelrebirth commented 3 years ago

I unfortunately only know a limited amount of go, I do not think I am qualified to do a PR to the repo for this... as much as I wish I could. I need a solution that works now, unfortunately that might mean not using this module. Thanks for the reply, I hope this gets fixed by someone someday.

elsudano commented 3 years ago

Hi pixelrebirth,

oouucchh, sorry to read this, unfortunately for now I haven't time to implement this in windows, maybe in the future.

Stay tuned for new releases.

Regards

martinrohrbach commented 3 years ago

I just downloaded the code on windows and compiled the project using Go and at least this part seems to work fine out of the box. I don't see why it should not work on Windows as well.

However, I'm having problems to get the plugin to work from a local folder. I might put some more effort into this later, however, maybe someone else could be able to give this a quick test?

+1 for the need for this plugin on Windows

martinrohrbach commented 3 years ago

Followup: Dev-Provider works if I put it in %APPDATA%\terraform.d\plugins\registry.terraform.io\elsudano\vmworkstation\0.2.2\windows_amd64, no additional config required. Nice, will start testing.

elsudano commented 3 years ago

Martín,

First to all, thanks for dedicate your time for this project

Also, thanks for realize the tests and checks for Windows

Moreover, if you think that the Windows binary is stable, maybe you can create a merger request for that and after the review we could included in the master branch.

Maybe in the next version on registry we could have a version of Windows

I looking forward your comments

Regards

martinrohrbach commented 3 years ago

The good news: the provider works on Windows out of the box as far as I can see. Install go and (whatever flavour of) make and a "make build" does the job. Once the API is enabled (vmrest.exe), I can use the provider and communication seems to work fine as well, I was able to successfully clone a VM straight away.

The bad news: I didn't check the workstation API beforehand and immediately noticed how limited the options are compared to the vSphere equivalent. Obviously that's not your fault but for me it means that I won't put any more work into this, I'm sorry.

For what it's worth, I added the following lines to my Makefile:

WINDIR = %APPDATA%\terraform.d\plugins\registry.terraform.io\elsudano\vmworkstation\$(VERSION)\windows_amd64
...
install-windows: build 
    @echo "Copying the provider to $(WINDIR)"
    @if not exist "$(WINDIR)" md "$(WINDIR)"
    @if exist "$(WINDIR)\$(BINARY)" del "$(WINDIR)\$(BINARY)"
    @copy $(BINARY) "$(WINDIR)"

This is for development only and allows you to use the provider locally straight away as described above. And technically, there's nothing preventing you from releasing the provider for Windows either.

elsudano commented 3 years ago

Hi Martin,

Yeaahh, first to all, thanks for your time...

Also, I would like continue with the develop of provider in a Windows system, please could you confirm me which are the tools that you used?

I mean, version of Go, how to install Go in windows environment, some extra tools, etc

Thank for your effort and I will try to complete your work

Regards

martinrohrbach commented 3 years ago

I literally downloaded the next best package from golang.org, here's "go version": go version go1.16.4 windows/amd64

For make, I use the package from from http://gnuwin32.sourceforge.net/packages/make.htm. Works fine including the addition to the Makefile I posted above.

Apart from that, the usual setup of Terraform as well as the VMware Workstation API as per the documentation.

And that's it, really straight forward, as described :)

elsudano commented 3 years ago

Hi Martin,

I hope you are fine...

Well, after you dedicating your time at investigate how to build a provider in Windows we have completed the updates in the Makefiles to create a binary in Windows too.

Moreover, we have added a Makefile in powershell, this script is similar that in Linux, that this manner you can build the provider to will do your testings if you want.

I hope that you can to test and give us a feedback that this version

Thanks in advance for your time

Regards