@@ -117,34 +117,6 @@ func resourceNsxtEdgeTransportNode() *schema.Resource {
117
117
Type : schema .TypeString ,
118
118
},
119
119
},
120
-
121
- "remote_tunnel_endpoint" : {
122
- Type : schema .TypeList ,
123
- Description : "Configuration for a remote tunnel endpoint" ,
124
- MaxItems : 1 ,
125
- Optional : true ,
126
- Elem : & schema.Resource {
127
- Schema : map [string ]* schema.Schema {
128
- "host_switch_name" : {
129
- Type : schema .TypeString ,
130
- Description : "The host switch name to be used for the remote tunnel endpoint" ,
131
- Required : true ,
132
- },
133
- "ip_assignment" : getIPAssignmentSchema (),
134
- "named_teaming_policy" : {
135
- Type : schema .TypeString ,
136
- Description : "The named teaming policy to be used by the remote tunnel endpoint" ,
137
- Optional : true ,
138
- },
139
- "rtep_vlan" : {
140
- Type : schema .TypeInt ,
141
- Description : "VLAN id for remote tunnel endpoint" ,
142
- Required : true ,
143
- ValidateFunc : validation .IntBetween (0 , 4094 ),
144
- },
145
- },
146
- },
147
- },
148
120
},
149
121
}
150
122
}
@@ -463,7 +435,7 @@ func getStandardHostSwitchSchema(nodeType string) *schema.Schema {
463
435
Computed : true ,
464
436
},
465
437
"host_switch_profile" : getHostSwitchProfileIDsSchema (),
466
- "ip_assignment" : getIPAssignmentSchema (),
438
+ "ip_assignment" : getIPAssignmentSchema (true ),
467
439
"pnic" : {
468
440
Type : schema .TypeList ,
469
441
Optional : true ,
@@ -541,7 +513,7 @@ func getStandardHostSwitchSchema(nodeType string) *schema.Schema {
541
513
Description : "The host switch id. This ID will be used to reference a host switch" ,
542
514
},
543
515
"host_switch_profile" : getHostSwitchProfileIDsSchema (),
544
- "ip_assignment" : getIPAssignmentSchema (),
516
+ "ip_assignment" : getIPAssignmentSchema (false ),
545
517
"uplink" : getUplinksSchema (),
546
518
},
547
519
},
@@ -645,12 +617,13 @@ func getHostSwitchProfileIDsSchema() *schema.Schema {
645
617
}
646
618
}
647
619
648
- func getIPAssignmentSchema () * schema.Schema {
620
+ func getIPAssignmentSchema (required bool ) * schema.Schema {
649
621
return & schema.Schema {
650
622
Type : schema .TypeList ,
651
623
Description : "Specification for IPs to be used with host switch virtual tunnel endpoints" ,
652
624
MaxItems : 1 ,
653
- Required : true ,
625
+ Required : required ,
626
+ Optional : ! required ,
654
627
Elem : & schema.Resource {
655
628
Schema : map [string ]* schema.Schema {
656
629
"assigned_by_dhcp" : {
@@ -745,18 +718,13 @@ func getTransportNodeFromSchema(d *schema.ResourceData) (*model.TransportNode, e
745
718
}
746
719
nodeDeploymentInfo := dataValue .(* data.StructValue )
747
720
748
- remoteTunnelEndpoint , err := getRemoteTunnelEndpointFromSchema (d )
749
- if err != nil {
750
- return nil , fmt .Errorf ("failed to create Transport Node: %v" , err )
751
- }
752
721
obj := model.TransportNode {
753
- Description : & description ,
754
- DisplayName : & displayName ,
755
- Tags : tags ,
756
- FailureDomainId : & failureDomain ,
757
- HostSwitchSpec : hostSwitchSpec ,
758
- NodeDeploymentInfo : nodeDeploymentInfo ,
759
- RemoteTunnelEndpoint : remoteTunnelEndpoint ,
722
+ Description : & description ,
723
+ DisplayName : & displayName ,
724
+ Tags : tags ,
725
+ FailureDomainId : & failureDomain ,
726
+ HostSwitchSpec : hostSwitchSpec ,
727
+ NodeDeploymentInfo : nodeDeploymentInfo ,
760
728
}
761
729
762
730
return & obj , nil
@@ -782,27 +750,6 @@ func resourceNsxtEdgeTransportNodeCreate(d *schema.ResourceData, m interface{})
782
750
return resourceNsxtEdgeTransportNodeRead (d , m )
783
751
}
784
752
785
- func getRemoteTunnelEndpointFromSchema (d * schema.ResourceData ) (* model.TransportNodeRemoteTunnelEndpointConfig , error ) {
786
- for _ , r := range d .Get ("remote_tunnel_endpoint" ).([]interface {}) {
787
- rte := r .(map [string ]interface {})
788
- hostSwitchName := rte ["host_switch_name" ].(string )
789
- ipAssignment , err := getIPAssignmentFromSchema (rte ["ip_assignment" ].([]interface {}))
790
- if err != nil {
791
- return nil , err
792
- }
793
- namedTeamingPolicy := rte ["named_teaming_policy" ].(string )
794
- rtepVlan := int64 (rte ["rtep_vlan" ].(int ))
795
-
796
- return & model.TransportNodeRemoteTunnelEndpointConfig {
797
- HostSwitchName : & hostSwitchName ,
798
- IpAssignmentSpec : ipAssignment ,
799
- NamedTeamingPolicy : & namedTeamingPolicy ,
800
- RtepVlan : & rtepVlan ,
801
- }, nil
802
- }
803
- return nil , nil
804
- }
805
-
806
753
func getEdgeNodeDeploymentConfigFromSchema (cfg interface {}) (* model.EdgeNodeDeploymentConfig , error ) {
807
754
converter := bindings .NewTypeConverter ()
808
755
@@ -1139,7 +1086,7 @@ func getHostSwitchSpecFromSchema(d *schema.ResourceData, nodeType string) (*data
1139
1086
}
1140
1087
var transportNodeSubProfileCfg []model.TransportNodeProfileSubConfig
1141
1088
if nodeType == nodeTypeHost {
1142
- transportNodeSubProfileCfg = getTransportNodeSubProfileCfg (swData ["transport_node_profile_sub_configs " ])
1089
+ transportNodeSubProfileCfg = getTransportNodeSubProfileCfg (swData ["transport_node_profile_sub_config " ])
1143
1090
}
1144
1091
transportZoneEndpoints := getTransportZoneEndpointsFromSchema (swData ["transport_zone_endpoint" ].([]interface {}))
1145
1092
@@ -1312,18 +1259,6 @@ func resourceNsxtEdgeTransportNodeRead(d *schema.ResourceData, m interface{}) er
1312
1259
return handleReadError (d , "TransportNode" , id , err )
1313
1260
}
1314
1261
1315
- if obj .RemoteTunnelEndpoint != nil {
1316
- rtep := make (map [string ]interface {})
1317
- rtep ["host_switch_name" ] = obj .RemoteTunnelEndpoint .HostSwitchName
1318
- rtep ["ip_assignment" ], err = setIPAssignmentInSchema (obj .RemoteTunnelEndpoint .IpAssignmentSpec )
1319
- if err != nil {
1320
- return handleReadError (d , "TransportNode" , id , err )
1321
- }
1322
- rtep ["named_teaming_policy" ] = obj .RemoteTunnelEndpoint .NamedTeamingPolicy
1323
- rtep ["rtep_vlan" ] = obj .RemoteTunnelEndpoint .RtepVlan
1324
- d .Set ("remote_tunnel_endpoint" , []map [string ]interface {}{rtep })
1325
- }
1326
-
1327
1262
return nil
1328
1263
}
1329
1264
@@ -1492,7 +1427,6 @@ func setHostSwitchSpecInSchema(d *schema.ResourceData, spec *data.StructValue, n
1492
1427
var tnpSubConfig []map [string ]interface {}
1493
1428
for _ , tnpsc := range sw .TransportNodeProfileSubConfigs {
1494
1429
e := make (map [string ]interface {})
1495
- var hsCfgOpts []map [string ]interface {}
1496
1430
hsCfgOpt := make (map [string ]interface {})
1497
1431
hsCfgOpt ["host_switch_id" ] = tnpsc .HostSwitchConfigOption .HostSwitchId
1498
1432
profiles := setHostSwitchProfileIDsInSchema (tnpsc .HostSwitchConfigOption .HostSwitchProfileIds )
@@ -1504,8 +1438,9 @@ func setHostSwitchSpecInSchema(d *schema.ResourceData, spec *data.StructValue, n
1504
1438
return err
1505
1439
}
1506
1440
hsCfgOpt ["uplink" ] = setUplinksFromSchema (tnpsc .HostSwitchConfigOption .Uplinks )
1507
- e ["host_switch_config_option" ] = hsCfgOpts
1441
+ e ["host_switch_config_option" ] = [] interface {}{ hsCfgOpt }
1508
1442
e ["name" ] = tnpsc .Name
1443
+ tnpSubConfig = append (tnpSubConfig , e )
1509
1444
}
1510
1445
elem ["transport_node_profile_sub_config" ] = tnpSubConfig
1511
1446
0 commit comments