Skip to content

Commit

Permalink
Handle edge_node import failures
Browse files Browse the repository at this point in the history
Some optional attributes aren't returned from NSX with v4.2.0 backend,
the PR handles this matter.

Signed-off-by: Kobi Samoray <[email protected]>
  • Loading branch information
ksamoray committed Feb 11, 2024
1 parent 8c0081c commit efccd32
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions nsxt/resource_nsxt_edge_transport_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -1232,14 +1232,18 @@ func resourceNsxtEdgeTransportNodeRead(d *schema.ResourceData, m interface{}) er
}
node := base.(model.EdgeNode)

err = setEdgeDeploymentConfigInSchema(d, node.DeploymentConfig)
if err != nil {
return handleReadError(d, "TransportNode", id, err)
if node.DeploymentConfig != nil {
err = setEdgeDeploymentConfigInSchema(d, node.DeploymentConfig)
if err != nil {
return handleReadError(d, "TransportNode", id, err)
}
}

err = setEdgeNodeSettingsInSchema(d, node.NodeSettings)
if err != nil {
return handleReadError(d, "TransportNode", id, err)
if node.NodeSettings != nil {
err = setEdgeNodeSettingsInSchema(d, node.NodeSettings)
if err != nil {
return handleReadError(d, "TransportNode", id, err)
}
}

// Set base object attributes
Expand Down

0 comments on commit efccd32

Please sign in to comment.