Skip to content

Commit

Permalink
Change password for BGP neighbor only on demand
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
annakhm committed Nov 30, 2023
1 parent 2e5e2bc commit 698597d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion nsxt/resource_nsxt_policy_bgp_neighbor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 698597d

Please sign in to comment.