Skip to content

Commit 85e116d

Browse files
committed
Add host_switch_name attribute to transport node
NSX requires host_switch_name specification even though this attribute is marked as deprecated. Without it, NSX issues an error when using multiple host switches. As this is an issue even if NSX addresses this later, it's better to add this attribute to the provider resources. Fixes: #1146 Signed-off-by: Kobi Samoray <[email protected]>
1 parent d255fda commit 85e116d

File tree

4 files changed

+14
-0
lines changed

4 files changed

+14
-0
lines changed

nsxt/resource_nsxt_edge_transport_node.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,12 @@ func getStandardHostSwitchSchema(nodeType string) *schema.Schema {
456456
Optional: true,
457457
Computed: true,
458458
},
459+
"host_switch_name": {
460+
Type: schema.TypeString,
461+
Description: "Host switch name. This name will be used to reference a host switch",
462+
Optional: true,
463+
Computed: true,
464+
},
459465
"host_switch_profile": getHostSwitchProfileIDsSchema(),
460466
"ip_assignment": getIPAssignmentSchema(),
461467
"pnic": {
@@ -1100,6 +1106,7 @@ func getHostSwitchSpecFromSchema(d *schema.ResourceData, nodeType string) (*data
11001106
swData := swEntry.(map[string]interface{})
11011107

11021108
hostSwitchID := swData["host_switch_id"].(string)
1109+
hostSwitchName := swData["host_switch_name"].(string)
11031110
var hostSwitchMode, hostSwitchType string
11041111
var isMigratePNics bool
11051112
var uplinks []model.VdsUplink
@@ -1145,6 +1152,9 @@ func getHostSwitchSpecFromSchema(d *schema.ResourceData, nodeType string) (*data
11451152
Pnics: pNics,
11461153
TransportZoneEndpoints: transportZoneEndpoints,
11471154
}
1155+
if hostSwitchName != "" {
1156+
hsw.HostSwitchName = &hostSwitchName
1157+
}
11481158
if nodeType == nodeTypeHost {
11491159
hsw.CpuConfig = cpuConfig
11501160
hsw.IsMigratePnics = &isMigratePNics
@@ -1449,6 +1459,7 @@ func setHostSwitchSpecInSchema(d *schema.ResourceData, spec *data.StructValue, n
14491459
for _, sw := range swEntry.HostSwitches {
14501460
elem := make(map[string]interface{})
14511461
elem["host_switch_id"] = sw.HostSwitchId
1462+
elem["host_switch_name"] = sw.HostSwitchName
14521463
profiles := setHostSwitchProfileIDsInSchema(sw.HostSwitchProfileIds)
14531464
if len(profiles) > 0 {
14541465
elem["host_switch_profile"] = profiles

website/docs/r/edge_transport_node.html.markdown

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ The following arguments are supported:
6666
* `failure_domain` - (Optional) Id of the failure domain.
6767
* `standard_host_switch` - (Required) Standard host switch specification.
6868
* `host_switch_id` - (Optional) The host switch id. This ID will be used to reference a host switch.
69+
* `host_switch_name` - (Optional) Host switch name. This name will be used to reference a host switch.
6970
* `host_switch_profile` - (Optional) Identifiers of host switch profiles to be associated with this host switch.
7071
* `ip_assignment` - (Required) - Specification for IPs to be used with host switch virtual tunnel endpoints. Should contain exatly one of the below:
7172
* `assigned_by_dhcp` - (Optional) Enables DHCP assignment.

website/docs/r/policy_host_transport_node.html.markdown

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ The following arguments are supported:
6363
* `num_lcores` - (Required) Number of Logical cpu cores (Lcores) to be placed on a specified NUMA node.
6464
* `numa_node_index` - (Required) Unique index of the Non Uniform Memory Access (NUMA) node.
6565
* `host_switch_id` - (Optional) The host switch id. This ID will be used to reference a host switch.
66+
* `host_switch_name` - (Optional) Host switch name. This name will be used to reference a host switch.
6667
* `host_switch_mode` - (Optional) Operational mode of a HostSwitch. Accepted values - 'STANDARD', 'ENS', 'ENS_INTERRUPT' or 'LEGACY'. The default value is 'STANDARD'.
6768
* `host_switch_profile` - (Optional) Policy path of host switch profiles to be associated with this host switch.
6869
* `ip_assignment` - (Required) - Specification for IPs to be used with host switch virtual tunnel endpoints. Should contain exatly one of the below:

website/docs/r/policy_host_transport_node_profile.html.markdown

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ The following arguments are supported:
4242
* `ignore_overridden_hosts` - (Optional) Determines if cluster-level configuration should be applied on overridden hosts
4343
* `standard_host_switch` - (Required) Standard host switch specification.
4444
* `host_switch_id` - (Optional) The host switch id. This ID will be used to reference a host switch.
45+
* `host_switch_name` - (Optional) Host switch name. This name will be used to reference a host switch.
4546
* `host_switch_mode` - (Optional) Operational mode of a HostSwitch. Accepted values - 'STANDARD', 'ENS', 'ENS_INTERRUPT' or 'LEGACY'. The default value is 'STANDARD'.
4647
* `host_switch_profile` - (Optional) Policy paths of host switch profiles to be associated with this host switch.
4748
* `ip_assignment` - (Required) - Specification for IPs to be used with host switch virtual tunnel endpoints. Should contain exactly one of the below:

0 commit comments

Comments
 (0)