From 9eed67ef6f6ff5944a7ac59d09e5b2431f190828 Mon Sep 17 00:00:00 2001 From: Anna Khmelnitsky Date: Thu, 10 Oct 2024 20:06:22 +0000 Subject: [PATCH] While listing VMs, pass enforcement point param This is needed for VMC use case Signed-off-by: Anna Khmelnitsky --- nsxt/resource_nsxt_policy_vm_tags.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/nsxt/resource_nsxt_policy_vm_tags.go b/nsxt/resource_nsxt_policy_vm_tags.go index 693c740ec..e82097596 100644 --- a/nsxt/resource_nsxt_policy_vm_tags.go +++ b/nsxt/resource_nsxt_policy_vm_tags.go @@ -78,7 +78,13 @@ func listAllPolicyVirtualMachines(context utl.SessionContext, connector client.C // parameters, respects cursor input. Therefore we determine end of VM list by // looking for empty result. sortBy := "external_id" - vms, err := client.List(cursor, nil, &boolFalse, nil, nil, &boolFalse, &sortBy) + var efPtr *string + if getPolicyEnforcementPoint(m) != "default" { + // To minimize changes, avoid passing enforcement point unless its specified in provider + enforcementPointPath := getPolicyEnforcementPointPath(m) + efPtr = &enforcementPointPath + } + vms, err := client.List(cursor, efPtr, &boolFalse, nil, nil, &boolFalse, &sortBy) if err != nil { return results, err }