terra-farm / terraform-provider-xenserver

XenServer provider for Terraform
https://terra-farm.github.io/provider-xenserver/
MIT License
73 stars 36 forks source link

Feature/guest ip #24

Open mborodin opened 6 years ago

mborodin commented 6 years ago

This PR solves #13 Example is here: https://github.com/mborodin/terraform-provider-xenserver/blob/de52ec6f2adb8ad48cef555d0d6c48e24cef2d9e/examples/datasource_vm_guest_metrics/main.tf

mborodin commented 6 years ago

@ringods done

ringods commented 6 years ago

@mborodin can you rebase from master? I fixed the .travis.yml file to not set up the golang cookie for pull requests.

zzzuzik commented 6 years ago

could this be merged please?

dot1q commented 6 years ago

I have noticed that the startup_delay isn't working and when

data "xenserver_vm_networks" "new_interfaces" {
  vm_uuid = "${xenserver_vm.vm1.id}"
  startup_delay = 80
}

executes before the VM has fully booted up and the tools have connected, which breaks the execution

The following error is returned

* data.xenserver_vm_networks.new_interfaces: data.xenserver_vm_networks.new_interfaces: API Error: HANDLE_INVALID VM_guest_metrics OpaqueRef:NULL
ringods commented 6 years ago

@mborodin I have finally found the time to review this PR. I am not so fond of the datasource name vm_guest_metrics. I know that the XAPI has different objects for:

But from a Terraform viewpoint, I rather would like to know all of this info from a single datasource xenserver_vm, with the same info also offered by the resource xenserver_vm.

What's your idea on renaming the datasource?

Also, could you rebase from master one last time? I merged a few other PRs last weekend.

debovema commented 6 years ago

@mborodin @ringods : any update on this one ?

ringods commented 6 years ago

@debovema I was still trying to discuss the datasource/resource naming with @mborodin. I would like to stick to creation of resources on the Terraform side. This pull request also exposes metrics which should be more for a monitoring tool, less for the terraform provider.

debovema commented 6 years ago

I agree, IP address of VM should be available as an attribute of the VM resource instead of only as a datasource. Otherwise it is not possible to use these IPs correctly in a count meta-parameter of other resources.

I submitted #38 which is the same as this one (#24) but rebased from master. You can ignore it if it is not needed.