elsudano / terraform-provider-vmworkstation

VmWare Workstation Pro provider for Terraform
MIT License
49 stars 19 forks source link

[Docs] Some `vmworkstation_vm` resource parameter aren't documented #17

Closed sticky-note closed 1 month ago

sticky-note commented 2 months ago

Workstation Pro 17.5.2 build-23775571 on Windows 11

With this snippet:

resource "vmworkstation_vm" "test_machine" {
  sourceid     = var.vmws_resource_frontend_sourceid
  denomination = var.vmws_resource_frontend_denomination
  description  = var.vmws_resource_frontend_description
  path         = var.vmws_resource_frontend_path
  processors   = var.vmws_resource_frontend_processors
  memory       = var.vmws_resource_frontend_memory
}

I faced this issue:

(...)
╷
│ Error: 100,One of the parameters was invalid: operation
│ 
│   with vmworkstation_vm.test_machine,
│   on main.tf line 1, in resource "vmworkstation_vm" "test_machine":
│    1: resource "vmworkstation_vm" "test_machine" {
│ 
╵

With some network sniffing and some code digging, I figured out that the desired argument passed to PUT /api/vms/{wm_id}/power was empty, the wmware API refers to it as operation Spotted that it is effectively passed to vmware-workstation-api-client PowerSwitch function via a resource parameter named state but it took me some time. So by adding following line, it works as expected.

resource "vmworkstation_vm" "test_machine" {
  (...)
  state        = "on"
}

I open this issue here to leave a trace and a memo to update the documentation or at least giving default values programmatically, Maybe documentation generation can be a good solution for the resources themselves, It seems that ip parameter is not in the provider README neither. -> https://developer.hashicorp.com/terraform/registry/providers/docs#generating-documentation Take a look here, it is good hygiene for the future :)

Thanks for sharing this provider anyway

elsudano commented 1 month ago

Hi @sticky-note

Thanks to point my that.

Regarding of the documentation, if you take a look carefully at the code this provider is old and it was implemented with the old framework, that means, that the documentation is created directly in the website/doc folder as you can see in this link https://developer.hashicorp.com/terraform/registry/providers/docs#directory-structure.

If we want to generate the documentation automatically we will need change the framework of the provider, that means that will have to develop from scratch the provider using the new framework.

For that reason I will going to close this issue until to start with the V2 of the provider