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

Fix crash in transport node resource #978

Merged
merged 1 commit into from
Sep 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions nsxt/resource_nsxt_transport_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ func resourceNsxtTransportNode() *schema.Resource {
"failure_domain": {
Type: schema.TypeString,
Optional: true,
Computed: true,
Description: "Id of the failure domain",
},
// host_switch_spec
Expand Down Expand Up @@ -146,6 +147,7 @@ func getNodeSchema(addlAttributes map[string]*schema.Schema, addExactlyOneOf boo
"external_id": {
Type: schema.TypeString,
Optional: true,
Computed: true,
Description: "ID of the Node",
},
"fqdn": {
Expand All @@ -157,6 +159,7 @@ func getNodeSchema(addlAttributes map[string]*schema.Schema, addExactlyOneOf boo
"ip_addresses": {
Type: schema.TypeList,
Optional: true,
Computed: true,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure about this. Is this field used by users to locate the node?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah, I see what you mean. When read it back this field might contain more IP addresses.

Description: "IP Addresses of the Node, version 4 or 6",
Elem: &schema.Schema{
Type: schema.TypeString,
Expand Down Expand Up @@ -267,6 +270,7 @@ func getEdgeNodeDeploymentConfigSchema() *schema.Schema {
Type: schema.TypeList,
MaxItems: 2,
Optional: true,
Computed: true,
Description: "Default gateway for the node",
Elem: &schema.Schema{
Type: schema.TypeString,
Expand Down Expand Up @@ -320,6 +324,7 @@ func getEdgeNodeDeploymentConfigSchema() *schema.Schema {
MaxItems: 1,
Description: "Resource reservation settings",
Optional: true,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"cpu_reservation_in_mhz": {
Expand Down Expand Up @@ -604,6 +609,7 @@ func getStandardHostSwitchSchema() *schema.Schema {
Type: schema.TypeString,
Description: "The host switch id. This ID will be used to reference a host switch",
Optional: true,
Computed: true,
},
"host_switch_mode": {
Type: schema.TypeString,
Expand Down Expand Up @@ -724,6 +730,7 @@ func getTransportZoneEndpointSchema() *schema.Schema {
"transport_zone_profile_id": {
Type: schema.TypeList,
Optional: true,
Computed: true,
Description: "Identifiers of the transport zone profiles associated with this transport zone endpoint on this transport node",
Elem: &schema.Schema{
Type: schema.TypeString,
Expand Down Expand Up @@ -783,7 +790,8 @@ func getIPAssignmentSchema() *schema.Schema {
"assigned_by_dhcp": {
Type: schema.TypeBool,
Optional: true,
Description: "Enables DHCP assignment. Should be set to true",
Default: false,
Description: "Enables DHCP assignment",
},
"static_ip": {
Type: schema.TypeList,
Expand Down Expand Up @@ -1954,7 +1962,7 @@ func resourceNsxtTransportNodeUpdate(d *schema.ResourceData, m interface{}) erro
return handleUpdateError("TransportNode", id, err)
}
revision := int64(d.Get("revision").(int))
*obj.Revision = revision
obj.Revision = &revision

_, err = client.Update(id, *obj, nil, nil, nil, nil, nil, nil, nil)
if err != nil {
Expand Down