Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot list ip addresses of when creating multiple virtual machine resources #63

Closed
chandru-tkc opened this issue Jun 18, 2019 · 3 comments

Comments

@chandru-tkc
Copy link
Contributor

Describe the bug
Cannot list ip addresses of when creating multiple virtual machine resources

Expected behavior
Should be able to list the ip addresses of all the vm resources using the following syntax
output "ip" { value = "${join(",",nutanix_virtual_machine.my-machine.*.nutanix_virtual_machine.deployment.*.nic_list_status.0.ip_endpoint_list.0.ip)}" }

If the above interpolation is not possible can we please expose the ip_address attribute from the resources that were created. According to this doc ip_address should be available on a virtual machine data source but trying to access it, fails with
Resource 'data.nutanix_virtual_machine.ips1' does not have attribute 'ip_address' for variable 'data.nutanix_virtual_machine.ips1.ip_address'

Logs
Trying to list the output getting the following error,
nutanix_virtual_machine.deployment’ does not have attribute ‘nic_list_status.0.ip_endpoint_list.0.ip

trying to access ip_address in vm data_source gets following error

Resource 'data.nutanix_virtual_machine.ips1' does not have attribute 'ip_address' for variable 'data.nutanix_virtual_machine.ips1.ip_address'

Versions (please complete the following information):

  • OS - OSX mojave
  • Terraform - 0.11.3
  • Nutanix Cluster - 5.10.2
  • Nutanix Prism Central - 5.10.2
  • 1.0.1

Additional context
Looks like we can't display the ip address when we have multiple nested lists/maps. Can we get the ip_address exposed from the created vm to access?

@fabiocruzcoelho
Copy link

Hello,

I also have the same problem, someone managed to solve?

I'm using the below version of terraform and provider
Terraform v0.12.18

  • provider.nutanix v1.0.2

I am using count.index to create VM multiples.

I can't get ip_address outputs.

My environment distributes IP via DHCP.

Example.

  value = "${lookup(nutanix_virtual_machine.vm.*.nic_list.0.ip_endpoint_list[0], "ip")}"
}

erro


  on ../../create_vms/outputs.tf line 29, in output "ip_address":
  29:   value = "${lookup(nutanix_virtual_machine.vm.*.nic_list.0.ip_endpoint_list[0], "ip")}"
    |----------------
    | nutanix_virtual_machine.vm is tuple with 1 element

Invalid value for "inputMap" parameter: lookup() requires a map as the first
argument.

Would you help me

Thanks

@fabiocruzcoelho
Copy link

Hello,

I can solve my problem with the function zipmap below.

# Show IP address
output "ip_address" {
  description = "Returns the name and ip_address of the created vm"
  value       = "${zipmap(nutanix_virtual_machine.vm.*.name, nutanix_virtual_machine.vm.*.nic_list.0.ip_endpoint_list.0.ip)}"
}

terraform output

ip_address = {
  "demo-01" = "10.50.4.242"
  "demo-02" = "10.50.4.136"
  "demo-03" = "10.50.4.229"
}

Thank you

@coderGo93
Copy link
Contributor

Hello @chandru-tkc, I'd like to know if this issue is still happening or not on branch master? just to be sure, please

@PacoDw PacoDw closed this as completed Jun 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants