From 698597daa76c7bda76b0f74f74e91bfbbe6cd62e Mon Sep 17 00:00:00 2001 From: Anna Khmelnitsky Date: Thu, 30 Nov 2023 00:33:24 +0000 Subject: [PATCH] Change password for BGP neighbor only on demand Since password is not sent back from NSX for security reasons, it will not be present in state after import. In this scenario, we need to avoid the password from being cleared next time an update is triggered on the imported resource. Hence we only update the password if a change in this field s detected. Note that user can leave the password blank in configuration of the imported resource. Signed-off-by: Anna Khmelnitsky --- nsxt/resource_nsxt_policy_bgp_neighbor.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nsxt/resource_nsxt_policy_bgp_neighbor.go b/nsxt/resource_nsxt_policy_bgp_neighbor.go index ecf26b689..d22cb5d95 100644 --- a/nsxt/resource_nsxt_policy_bgp_neighbor.go +++ b/nsxt/resource_nsxt_policy_bgp_neighbor.go @@ -290,13 +290,16 @@ func resourceNsxtPolicyBgpNeighborResourceDataToStruct(d *schema.ResourceData, i KeepAliveTime: &keepAliveTime, MaximumHopLimit: &maximumHopLimit, NeighborAddress: &neighborAddress, - Password: &password, RemoteAsNum: &remoteAsNum, RouteFiltering: rFilters, SourceAddresses: sourceAddresses, Id: &id, } + if d.HasChange("password") { + neighborStruct.Password = &password + } + return neighborStruct, nil }