Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Edge transport nodes which were created externally #1473

Merged
merged 1 commit into from
Dec 19, 2024

Conversation

ksamoray
Copy link
Collaborator

Normally users create Edge Transport Nodes within NSX, which deploys them into the regsitered compute manager. However, users have the option to do the same by deploying the Edge appliance anywhere, outside NSX, and registering it with NSX using the Edge CLI or OVA parameters. Later, this Edge appliance can be converted into a transport node using NSX API - this change attempts to utilize this capability.

Fixes: #1459

@ksamoray ksamoray force-pushed the edge_ova_create branch 2 times, most recently from e20b1dc to d9d4d11 Compare November 27, 2024 14:30
@@ -725,6 +745,16 @@ func resourceNsxtEdgeTransportNodeCreate(d *schema.ResourceData, m interface{})
connector := getPolicyConnector(m)
client := nsx.NewTransportNodesClient(connector)

nodeID := d.Get("node_id").(string)
if nodeID != "" {
_, err := client.Get(nodeID)
Copy link
Collaborator

@annakhm annakhm Dec 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to set revision/other computed properties here?

@annakhm annakhm changed the title Add support for Edge transport nodes which were created externally [WIP] Add support for Edge transport nodes which were created externally Dec 12, 2024
@salv-orlando salv-orlando added this to the v3.8.0 milestone Dec 13, 2024
@salv-orlando
Copy link
Member

Keeping this PR in 3.8.0 milestone as we're almost done with the review process.

@ksamoray ksamoray changed the title [WIP] Add support for Edge transport nodes which were created externally Add support for Edge transport nodes which were created externally Dec 18, 2024
converter := bindings.NewTypeConverter()
base, errs := converter.ConvertToGolang(obj.NodeDeploymentInfo, mpmodel.EdgeNodeBindingType())
if errs != nil {
return handleReadError(d, "TransportNode", nodeID, errs[0])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should still be handleCreateError, since we're in create flow

}

d.SetId(nodeID)
return resourceNsxtEdgeTransportNodeUpdate(d, m)
Copy link
Collaborator

@annakhm annakhm Dec 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case update fails, there might be a state problem here. Since we already performed d.SetId(nodeId), the resource will be already present in state, if I'm not mistaken.
If would be safer to catch error here, and in case Update fails, nullify the Id.

sdk reference:
https://github.com/hashicorp/terraform-plugin-sdk/blob/00fc746ade8f31a96a9030b867bedcff3365afa5/helper/schema/resource.go#L134

Normally users create Edge Transport Nodes within NSX, which deploys them into the regsitered compute manager.
However, users have the option to do the same by deploying the Edge appliance anywhere, outside NSX, and registering it with NSX using the Edge CLI or OVA parameters.
Later, this Edge appliance can be converted into a transport node using NSX API - this change attempts to utilize this capability.

Fixes: vmware#1459
Signed-off-by: Kobi Samoray <kobi.samoray@broadcom.com>
@salv-orlando salv-orlando merged commit d7a0096 into vmware:master Dec 19, 2024
5 checks passed
@ksamoray ksamoray deleted the edge_ova_create branch December 22, 2024 08:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

nsxt_edge_transport_node not usable for existing edge
3 participants