-
Notifications
You must be signed in to change notification settings - Fork 85
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
Conversation
aef02f1
to
8bf7432
Compare
e20b1dc
to
d9d4d11
Compare
d9d4d11
to
039889c
Compare
@@ -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) |
There was a problem hiding this comment.
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?
Keeping this PR in 3.8.0 milestone as we're almost done with the review process. |
039889c
to
d1545a1
Compare
converter := bindings.NewTypeConverter() | ||
base, errs := converter.ConvertToGolang(obj.NodeDeploymentInfo, mpmodel.EdgeNodeBindingType()) | ||
if errs != nil { | ||
return handleReadError(d, "TransportNode", nodeID, errs[0]) |
There was a problem hiding this comment.
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
d1545a1
to
c5c64ca
Compare
c5c64ca
to
400861e
Compare
} | ||
|
||
d.SetId(nodeID) | ||
return resourceNsxtEdgeTransportNodeUpdate(d, m) |
There was a problem hiding this comment.
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>
400861e
to
738a846
Compare
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