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

refactor: add nic_list_status to separate the computed values #40

Merged
merged 8 commits into from
Mar 29, 2019

Conversation

marinsalinas
Copy link
Contributor

@marinsalinas marinsalinas commented Mar 22, 2019

closes #12 #17 #19

We added the nic_list_status attribute (computed) to show all the nic_list with the ip_endpoint_list from the Status object.

You could get the IP address by this:

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

"subnet_name": {
Type: schema.TypeString,
Optional: true,
Computed: true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of this attributes are only computed right?

@@ -737,7 +813,10 @@ func resourceNutanixVirtualMachineRead(d *schema.ResourceData, meta interface{})
if err := d.Set("availability_zone_reference", flattenReferenceValues(resp.Status.AvailabilityZoneReference)); err != nil {
return fmt.Errorf("error setting availability_zone_reference for Virtual Machine %s: %s", d.Id(), err)
}
if err := d.Set("nic_list", flattenNicList(resp.Status.Resources.NicList)); err != nil {
if err := d.Set("nic_list", flattenNicList(resp.Spec.Resources.NicList)); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If nic_list_status contains the output of the request and nic_list contains the arguments to create the nics, I think you should not set them here nic_list

@thetonymaster
Copy link
Contributor

Also, can you add a test case for this?

@marinsalinas
Copy link
Contributor Author

Also, can you add a test case for this?

Yes I'd already added a test case for subnets/NICs in 1bf461b, let me cherry pick and modify for the new configuration.

@ghost ghost added size/L and removed size/M labels Mar 25, 2019
@marinsalinas marinsalinas force-pushed the ip-endpoint-status-#12 branch from a477780 to 68963db Compare March 25, 2019 15:11
@marinsalinas marinsalinas force-pushed the ip-endpoint-status-#12 branch from 68963db to 9eb7f20 Compare March 25, 2019 16:12
@thetonymaster
Copy link
Contributor

Not gonna sign this off until we can try this on the lab environment.

@ghost ghost added size/XL and removed size/L labels Mar 28, 2019
@marinsalinas marinsalinas force-pushed the ip-endpoint-status-#12 branch 6 times, most recently from 9d2dc6f to a8f8922 Compare March 29, 2019 21:04
@marinsalinas marinsalinas force-pushed the ip-endpoint-status-#12 branch from a8f8922 to 301201a Compare March 29, 2019 21:44
@marinsalinas marinsalinas merged commit 9c09b5a into master Mar 29, 2019
@marinsalinas marinsalinas deleted the ip-endpoint-status-#12 branch March 29, 2019 23:11
yannickstruyf3 pushed a commit to yannickstruyf3/terraform-provider-nutanix that referenced this pull request Nov 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

nutanix_virtual_machine, ip_endpoint_list not correctly working
2 participants