Skip to content

Commit

Permalink
Set member index when matching display name
Browse files Browse the repository at this point in the history
member index should be set also when not matching member_index
attribute.

Signed-off-by: Kobi Samoray <[email protected]>
  • Loading branch information
ksamoray committed Feb 13, 2024
1 parent 9e55291 commit 26db40d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion nsxt/data_source_nsxt_policy_edge_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
"github.com/vmware/vsphere-automation-sdk-go/runtime/bindings"
"github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/sites/enforcement_points/edge_clusters"
"github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model"
)
Expand Down Expand Up @@ -47,10 +48,17 @@ func dataSourceNsxtPolicyEdgeNodeRead(d *schema.ResourceData, m interface{}) err
if memberIndexSet {
query["member_index"] = strconv.Itoa(memberIndex.(int))
}
_, err := policyDataSourceResourceReadWithValidation(d, getPolicyConnector(m), getSessionContext(d, m), "PolicyEdgeNode", query, false)
obj, err := policyDataSourceResourceReadWithValidation(d, getPolicyConnector(m), getSessionContext(d, m), "PolicyEdgeNode", query, false)
if err != nil {
return err
}
converter := bindings.NewTypeConverter()
dataValue, errors := converter.ConvertToGolang(obj, model.PolicyEdgeNodeBindingType())
if len(errors) > 0 {
return errors[0]
}
policyEdgeNode := dataValue.(model.PolicyEdgeNode)
d.Set("member_index", policyEdgeNode.MemberIndex)
return nil
}

Expand Down

0 comments on commit 26db40d

Please sign in to comment.