From f370a0a5ec76f6730680569cdf5063d55c1d57a7 Mon Sep 17 00:00:00 2001 From: Kobi Samoray Date: Tue, 19 Sep 2023 16:19:37 +0300 Subject: [PATCH] Use general names for attributes of hostSwitch HostSwitch schema is used in both policy and MP with the same struct heirarchy, but id fields within the schema are used to store policy paths for policy resources. Therefore it's worthwhile to keep these with general names without _id suffix. Signed-off-by: Kobi Samoray --- nsxt/resource_nsxt_transport_node.go | 44 +++++++++---------- website/docs/d/compute_manager.html.markdown | 2 +- .../transport_node_realization.html.markdown | 10 ++--- .../docs/r/cluster_virtual_ip.html.markdown | 2 +- ..._host_transport_node_profile.html.markdown | 24 +++++----- website/docs/r/transport_node.html.markdown | 28 ++++++------ 6 files changed, 55 insertions(+), 55 deletions(-) diff --git a/nsxt/resource_nsxt_transport_node.go b/nsxt/resource_nsxt_transport_node.go index 10bc33cee..3f1b157b1 100644 --- a/nsxt/resource_nsxt_transport_node.go +++ b/nsxt/resource_nsxt_transport_node.go @@ -21,7 +21,7 @@ var ipAssignmentTypes = []string{ "assigned_by_dhcp", "static_ip_list", "static_ip_mac", - "static_ip_pool_id", + "static_ip_pool", } var hostSwitchModeValues = []string{ @@ -612,7 +612,7 @@ func getStandardHostSwitchSchema() *schema.Schema { Optional: true, ValidateFunc: validation.StringInSlice(hostSwitchModeValues, false), }, - "host_switch_profile_id": getHostSwitchProfileIDsSchema(), + "host_switch_profile": getHostSwitchProfileIDsSchema(), "host_switch_type": { Type: schema.TypeString, Description: "Type of HostSwitch", @@ -645,7 +645,7 @@ func getStandardHostSwitchSchema() *schema.Schema { }, }, }, - "portgroup_transport_zone_id": { + "portgroup_transport_zone": { Type: schema.TypeString, Optional: true, Description: "Transport Zone ID representing the DVS used in NSX on DVPG", @@ -669,9 +669,9 @@ func getStandardHostSwitchSchema() *schema.Schema { Optional: true, Description: "The host switch id. This ID will be used to reference a host switch", }, - "host_switch_profile_id": getHostSwitchProfileIDsSchema(), - "ip_assignment": getIPAssignmentSchema(), - "uplink": getUplinksSchema(), + "host_switch_profile": getHostSwitchProfileIDsSchema(), + "ip_assignment": getIPAssignmentSchema(), + "uplink": getUplinksSchema(), }, }, }, @@ -716,12 +716,12 @@ func getTransportZoneEndpointSchema() *schema.Schema { Description: "Transport zone endpoints", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "transport_zone_id": { + "transport_zone": { Type: schema.TypeString, Required: true, Description: "Unique ID identifying the transport zone for this endpoint", }, - "transport_zone_profile_id": { + "transport_zone_profile": { Type: schema.TypeList, Optional: true, Description: "Identifiers of the transport zone profiles associated with this transport zone endpoint on this transport node", @@ -861,7 +861,7 @@ func getIPAssignmentSchema() *schema.Schema { }, }, }, - "static_ip_pool_id": { + "static_ip_pool": { Type: schema.TypeString, Optional: true, Description: "IP assignment specification for Static IP Pool", @@ -1303,7 +1303,7 @@ func getIPAssignmentFromSchema(ipAssignmentList interface{}) (*data.StructValue, break } - case "static_ip_pool_id": + case "static_ip_pool": staticIPPoolID := iaData.(string) elem := model.StaticIpPoolSpec{ IpPoolId: &staticIPPoolID, @@ -1374,7 +1374,7 @@ func getHostSwitchSpecFromSchema(d *schema.ResourceData) (*data.StructValue, err cpuConfig := getCPUConfigFromSchema(swData["cpu_config"].([]interface{})) hostSwitchID := swData["host_switch_id"].(string) hostSwitchMode := swData["host_switch_mode"].(string) - hostSwitchProfileIDs := getHostSwitchProfileIDsFromSchema(swData["host_switch_profile_id"].([]interface{})) + hostSwitchProfileIDs := getHostSwitchProfileIDsFromSchema(swData["host_switch_profile"].([]interface{})) hostSwitchType := swData["host_switch_type"].(string) iPAssignmentSpec, err := getIPAssignmentFromSchema(swData["ip_assignment"]) isMigratePNics := swData["is_migrate_pnics"].(bool) @@ -1392,7 +1392,7 @@ func getHostSwitchSpecFromSchema(d *schema.ResourceData) (*data.StructValue, err if err != nil { return nil, fmt.Errorf("error parsing HostSwitchSpec schema %v", err) } - portGroupTZID := swData["portgroup_transport_zone_id"].(string) + portGroupTZID := swData["portgroup_transport_zone"].(string) transportNodeSubProfileCfg := getTransportNodeSubProfileCfg(swData["transport_node_profile_sub_configs"]) transportZoneEndpoints := getTransportZoneEndpointsFromSchema(swData["transport_zone_endpoint"].([]interface{})) uplinks := getUplinksFromSchema(swData["uplink"].([]interface{})) @@ -1462,10 +1462,10 @@ func getTransportZoneEndpointsFromSchema(endpointList []interface{}) []model.Tra var tzEPList []model.TransportZoneEndPoint for _, endpoint := range endpointList { data := endpoint.(map[string]interface{}) - transportZoneID := data["transport_zone_id"].(string) + transportZoneID := data["transport_zone"].(string) var transportZoneProfileIDs []model.TransportZoneProfileTypeIdEntry - if data["transport_zone_profile_ids"] != nil { - for _, tzpID := range data["transport_zone_profile_ids"].([]interface{}) { + if data["transport_zone_profile"] != nil { + for _, tzpID := range data["transport_zone_profile"].([]interface{}) { profileID := tzpID.(string) resourceType := model.TransportZoneProfileTypeIdEntry_RESOURCE_TYPE_BFDHEALTHMONITORINGPROFILE elem := model.TransportZoneProfileTypeIdEntry{ @@ -1515,7 +1515,7 @@ func getTransportNodeSubProfileCfg(iface interface{}) []model.TransportNodeProfi for _, cfgOpt := range data["host_switch_config_option"].([]interface{}) { opt := cfgOpt.(map[string]interface{}) swID := opt["host_switch_id"].(string) - profileIDs := getHostSwitchProfileIDsFromSchema(opt["host_switch_profile_id"].([]interface{})) + profileIDs := getHostSwitchProfileIDsFromSchema(opt["host_switch_profile"].([]interface{})) iPAssignmentSpec, _ := getIPAssignmentFromSchema(opt["ip_assignment"].([]interface{})) uplinks := getUplinksFromSchema(opt["uplink"].([]interface{})) swCfgOpt = &model.HostSwitchConfigOption{ @@ -1777,7 +1777,7 @@ func setHostSwitchSpecInSchema(d *schema.ResourceData, spec *data.StructValue) e elem["cpu_config"] = cpuConfig elem["host_switch_id"] = sw.HostSwitchId elem["host_switch_mode"] = sw.HostSwitchMode - elem["host_switch_profile_id"] = setHostSwitchProfileIDsInSchema(sw.HostSwitchProfileIds) + elem["host_switch_profile"] = setHostSwitchProfileIDsInSchema(sw.HostSwitchProfileIds) elem["host_switch_type"] = sw.HostSwitchType var err error elem["ip_assignment"], err = setIPAssignmentInSchema(sw.IpAssignmentSpec) @@ -1793,14 +1793,14 @@ func setHostSwitchSpecInSchema(d *schema.ResourceData, spec *data.StructValue) e pnics = append(pnics, e) } elem["pnic"] = pnics - elem["portgroup_transport_zone_id"] = sw.PortgroupTransportZoneId + elem["portgroup_transport_zone"] = sw.PortgroupTransportZoneId var tnpSubConfig []map[string]interface{} for _, tnpsc := range sw.TransportNodeProfileSubConfigs { e := make(map[string]interface{}) var hsCfgOpts []map[string]interface{} hsCfgOpt := make(map[string]interface{}) hsCfgOpt["host_switch_id"] = tnpsc.HostSwitchConfigOption.HostSwitchId - hsCfgOpt["host_switch_profile_id"] = setHostSwitchProfileIDsInSchema(tnpsc.HostSwitchConfigOption.HostSwitchProfileIds) + hsCfgOpt["host_switch_profile"] = setHostSwitchProfileIDsInSchema(tnpsc.HostSwitchConfigOption.HostSwitchProfileIds) hsCfgOpt["ip_assignment"], err = setIPAssignmentInSchema(tnpsc.HostSwitchConfigOption.IpAssignmentSpec) if err != nil { return err @@ -1856,12 +1856,12 @@ func setTransportZoneEndpointInSchema(endpoints []model.TransportZoneEndPoint) i var endpointList []map[string]interface{} for _, endpoint := range endpoints { e := make(map[string]interface{}) - e["transport_zone_id"] = endpoint.TransportZoneId + e["transport_zone"] = endpoint.TransportZoneId var tzpIDs []string for _, tzpID := range endpoint.TransportZoneProfileIds { tzpIDs = append(tzpIDs, *tzpID.ProfileId) } - e["transport_zone_profile_id"] = tzpIDs + e["transport_zone_profile"] = tzpIDs endpointList = append(endpointList, e) } return endpointList @@ -1930,7 +1930,7 @@ func setIPAssignmentInSchema(spec *data.StructValue) (interface{}, error) { return nil, errs[0] } ipAsEntry := entry.(model.StaticIpPoolSpec) - elem["static_ip_pool_id"] = ipAsEntry.IpPoolId + elem["static_ip_pool"] = ipAsEntry.IpPoolId } return []interface{}{elem}, nil } diff --git a/website/docs/d/compute_manager.html.markdown b/website/docs/d/compute_manager.html.markdown index 45228666b..17c2c095c 100644 --- a/website/docs/d/compute_manager.html.markdown +++ b/website/docs/d/compute_manager.html.markdown @@ -27,4 +27,4 @@ data "nsxt_compute_manager" "test_vcenter" { In addition to arguments listed above, the following attributes are exported: * `description` - The description of the Compute Manager. -* `server` - IP address or hostname of compute manager. \ No newline at end of file +* `server` - IP address or hostname of compute manager. diff --git a/website/docs/d/transport_node_realization.html.markdown b/website/docs/d/transport_node_realization.html.markdown index d3dc83de1..ff3022540 100644 --- a/website/docs/d/transport_node_realization.html.markdown +++ b/website/docs/d/transport_node_realization.html.markdown @@ -19,14 +19,14 @@ resource "nsxt_transport_node" "test" { host_switch_mode = "STANDARD" host_switch_type = "NVDS" ip_assignment { - static_ip_pool_id = data.nsxt_ip_pool.ipp1.id + static_ip_pool = data.nsxt_ip_pool.ipp1.id } transport_zone_endpoint { - transport_zone_id = data.nsxt_transport_zone.tz1.id - transport_zone_profile_id = ["52035bb3-ab02-4a08-9884-18631312e50a"] + transport_zone = data.nsxt_transport_zone.tz1.id + transport_zone_profile = ["52035bb3-ab02-4a08-9884-18631312e50a"] } - host_switch_profile_id = [nsxt_uplink_host_switch_profile.hsw_profile1.id] - is_migrate_pnics = false + host_switch_profile = [nsxt_uplink_host_switch_profile.hsw_profile1.id] + is_migrate_pnics = false pnic { device_name = "fp-eth0" uplink_name = "uplink1" diff --git a/website/docs/r/cluster_virtual_ip.html.markdown b/website/docs/r/cluster_virtual_ip.html.markdown index 1bcc8ab42..2d7900dde 100644 --- a/website/docs/r/cluster_virtual_ip.html.markdown +++ b/website/docs/r/cluster_virtual_ip.html.markdown @@ -31,4 +31,4 @@ The following arguments are supported: ## Importing -Importing is not supported for this resource. \ No newline at end of file +Importing is not supported for this resource. diff --git a/website/docs/r/policy_host_transport_node_profile.html.markdown b/website/docs/r/policy_host_transport_node_profile.html.markdown index d142e26ef..1bef4bd46 100644 --- a/website/docs/r/policy_host_transport_node_profile.html.markdown +++ b/website/docs/r/policy_host_transport_node_profile.html.markdown @@ -22,10 +22,10 @@ resource "nsxt_policy_host_transport_node_profile" "test" { assigned_by_dhcp = true } transport_zone_endpoint { - transport_zone_id = data.nsxt_transport_zone.tz1.id + transport_zone = data.nsxt_transport_zone.tz1.id } - host_switch_profile_id = [nsxt_uplink_host_switch_profile.hsw_profile1.id] - is_migrate_pnics = false + host_switch_profile = [nsxt_uplink_host_switch_profile.hsw_profile1.path] + is_migrate_pnics = false pnic { device_name = "fp-eth0" uplink_name = "uplink1" @@ -48,7 +48,7 @@ The following arguments are supported: * `numa_node_index` - (Required) Unique index of the Non Uniform Memory Access (NUMA) node. * `host_switch_id` - (Optional) The host switch id. This ID will be used to reference a host switch. * `host_switch_mode` - (Optional) Operational mode of a HostSwitch. Accepted values - 'STANDARD', 'ENS', 'ENS_INTERRUPT' or 'LEGACY'. The default value is 'STANDARD'. - * `host_switch_profile_id` - (Optional) Identifiers of host switch profiles to be associated with this host switch. + * `host_switch_profile` - (Optional) Policy paths of host switch profiles to be associated with this host switch. * `host_switch_type` - (Optional) Type of HostSwitch. Accepted values - 'NVDS' or 'VDS'. The default value is 'NVDS'. * `ip_assignment` - (Required) - Specification for IPs to be used with host switch virtual tunnel endpoints. Should contain exactly one of the below: * `assigned_by_dhcp` - (Optional) Enables DHCP assignment. Should be set to true. @@ -62,16 +62,16 @@ The following arguments are supported: * `ip_mac_pair` - (Required) List of IPs and MACs for transport node host switch virtual tunnel endpoints. * `ip` - (Required) IP address. * `mac` - (Required) MAC address. - * `static_ip_pool_id` - (Optional) IP assignment specification for Static IP Pool. + * `static_ip_pool` - (Optional) IP assignment specification for Static IP Pool. * `is_migrate_pnics` - (Optional) Migrate any pnics which are in use. * `pnic` - (Optional) Physical NICs connected to the host switch. * `device_name` - (Required) Device name or key. * `uplink_name` - (Required) Uplink name for this Pnic. - * `portgroup_transport_zone_id` - (Optional) Transport Zone ID representing the DVS used in NSX on DVPG. + * `portgroup_transport_zone` - (Optional) Transport Zone policy path representing the DVS used in NSX on DVPG. * `transport_node_profile_sub_config` - (Optional) Transport Node Profile sub-configuration Options. * `host_switch_config_option` - (Required) Subset of the host switch configuration. * `host_switch_id` - (Optional) The host switch id. This ID will be used to reference a host switch. - * `host_switch_profile_id` - (Optional) Identifiers of host switch profiles to be associated with this host switch. + * `host_switch_profile` - (Optional) Policy paths of host switch profiles to be associated with this host switch. * `ip_assignment` - (Required) - Specification for IPs to be used with host switch virtual tunnel endpoints. Should contain exatly one of the below: * `assigned_by_dhcp` - (Optional) Enables DHCP assignment. Should be set to true. * `static_ip` - (Optional) IP assignment specification for Static IP List. @@ -84,15 +84,15 @@ The following arguments are supported: * `ip_mac_pair` - (Required) List of IPs and MACs for transport node host switch virtual tunnel endpoints. * `ip` - (Required) IP address. * `mac` - (Required) MAC address. - * `static_ip_pool_id` - (Optional) IP assignment specification for Static IP Pool. + * `static_ip_pool` - (Optional) IP assignment specification for Static IP Pool. * `uplink` - (Optional) Uplink/LAG of VMware vSphere Distributed Switch connected to the HostSwitch. * `uplink_name` - (Required) Uplink name from UplinkHostSwitch profile. * `vds_lag_name` - (Optional) Link Aggregation Group (LAG) name of Virtual Distributed Switch. * `vds_uplink_name` - (Optional) Uplink name of VMware vSphere Distributed Switch (VDS). * `name` - (Required) Name of the transport node profile config option. * `transport_zone_endpoint` - (Optional) Transport zone endpoints - * `transport_zone_id` - (Required) Unique ID identifying the transport zone for this endpoint. - * `transport_zone_profile_id` - (Optional) Identifiers of the transport zone profiles associated with this transport zone endpoint on this transport node. + * `transport_zone` - (Required) Policy path of the transport zone for this endpoint. + * `transport_zone_profile` - (Optional) Policy paths of the transport zone profiles associated with this transport zone endpoint on this transport node. * `uplink` - (Optional) Uplink/LAG of VMware vSphere Distributed Switch connected to the HostSwitch. * `uplink_name` - (Required) Uplink name from UplinkHostSwitch profile. * `vds_lag_name` - (Optional) Link Aggregation Group (LAG) name of Virtual Distributed Switch. @@ -104,8 +104,8 @@ The following arguments are supported: * `endpoint` - (Optional) Name of the virtual tunnel endpoint which is preconfigured on this host switch. * `host_switch_id` - (Required) External Id of the preconfigured host switch. * `transport_zone_endpoint` - (Optional) Transport zone endpoints - * `transport_zone_id` - (Required) Unique ID identifying the transport zone for this endpoint. - * `transport_zone_profile_id` - (Optional) Identifiers of the transport zone profiles associated with this transport zone endpoint on this transport node. + * `transport_zone` - (Required) Policy path of the transport zone for this endpoint. + * `transport_zone_profile` - (Optional) Policy paths of the transport zone profiles associated with this transport zone endpoint on this transport node. In addition to arguments listed above, the following attributes are exported: diff --git a/website/docs/r/transport_node.html.markdown b/website/docs/r/transport_node.html.markdown index 3f8d7d914..7806250e8 100644 --- a/website/docs/r/transport_node.html.markdown +++ b/website/docs/r/transport_node.html.markdown @@ -23,11 +23,11 @@ resource "nsxt_transport_node" "test" { assigned_by_dhcp = true } transport_zone_endpoint { - transport_zone_id = data.nsxt_transport_zone.tz1.id - transport_zone_profile_id = ["52035bb3-ab02-4a08-9884-18631312e50a"] + transport_zone = data.nsxt_transport_zone.tz1.id + transport_zone_profile = ["52035bb3-ab02-4a08-9884-18631312e50a"] } - host_switch_profile_id = [nsxt_uplink_host_switch_profile.hsw_profile1.id] - is_migrate_pnics = false + host_switch_profile = [nsxt_uplink_host_switch_profile.hsw_profile1.id] + is_migrate_pnics = false pnic { device_name = "fp-eth0" uplink_name = "uplink1" @@ -75,7 +75,7 @@ The following arguments are supported: * `numa_node_index` - (Required) Unique index of the Non Uniform Memory Access (NUMA) node. * `host_switch_id` - (Optional) The host switch id. This ID will be used to reference a host switch. * `host_switch_mode` - (Optional) Operational mode of a HostSwitch. Accepted values - 'STANDARD', 'ENS', 'ENS_INTERRUPT' or 'LEGACY'. The default value is 'STANDARD'. - * `host_switch_profile_id` - (Optional) Identifiers of host switch profiles to be associated with this host switch. + * `host_switch_profile` - (Optional) Identifiers of host switch profiles to be associated with this host switch. * `host_switch_type` - (Optional) Type of HostSwitch. Accepted values - 'NVDS' or 'VDS'. The default value is 'NVDS'. * `ip_assignment` - (Required) - Specification for IPs to be used with host switch virtual tunnel endpoints. Should contain exatly one of the below: * `assigned_by_dhcp` - (Optional) Enables DHCP assignment. Should be set to true. @@ -89,16 +89,16 @@ The following arguments are supported: * `ip_mac_pair` - (Required) List of IPs and MACs for transport node host switch virtual tunnel endpoints. * `ip` - (Required) IP address. * `mac` - (Required) MAC address. - * `static_ip_pool_id` - (Optional) IP assignment specification for Static IP Pool. + * `static_ip_pool` - (Optional) IP assignment specification for Static IP Pool. * `is_migrate_pnics` - (Optional) Migrate any pnics which are in use. * `pnic` - (Optional) Physical NICs connected to the host switch. * `device_name` - (Required) Device name or key. * `uplink_name` - (Required) Uplink name for this Pnic. - * `portgroup_transport_zone_id` - (Optional) Transport Zone ID representing the DVS used in NSX on DVPG. + * `portgroup_transport_zone` - (Optional) Transport Zone ID representing the DVS used in NSX on DVPG. * `transport_node_profile_sub_config` - (Optional) Transport Node Profile sub-configuration Options. * `host_switch_config_option` - (Required) Subset of the host switch configuration. * `host_switch_id` - (Optional) The host switch id. This ID will be used to reference a host switch. - * `host_switch_profile_id` - (Optional) Identifiers of host switch profiles to be associated with this host switch. + * `host_switch_profile` - (Optional) Identifiers of host switch profiles to be associated with this host switch. * `ip_assignment` - (Required) - Specification for IPs to be used with host switch virtual tunnel endpoints. Should contain exatly one of the below: * `assigned_by_dhcp` - (Optional) Enables DHCP assignment. Should be set to true. * `static_ip` - (Optional) IP assignment specification for Static IP List. @@ -111,15 +111,15 @@ The following arguments are supported: * `ip_mac_pair` - (Required) List of IPs and MACs for transport node host switch virtual tunnel endpoints. * `ip` - (Required) IP address. * `mac` - (Required) MAC address. - * `static_ip_pool_id` - (Optional) IP assignment specification for Static IP Pool. + * `static_ip_pool` - (Optional) IP assignment specification for Static IP Pool. * `uplink` - (Optional) Uplink/LAG of VMware vSphere Distributed Switch connected to the HostSwitch. * `uplink_name` - (Required) Uplink name from UplinkHostSwitch profile. * `vds_lag_name` - (Optional) Link Aggregation Group (LAG) name of Virtual Distributed Switch. * `vds_uplink_name` - (Optional) Uplink name of VMware vSphere Distributed Switch (VDS). * `name` - (Required) Name of the transport node profile config option. * `transport_zone_endpoint` - (Optional) Transport zone endpoints - * `transport_zone_id` - (Required) Unique ID identifying the transport zone for this endpoint. - * `transport_zone_profile_id` - (Optional) Identifiers of the transport zone profiles associated with this transport zone endpoint on this transport node. + * `transport_zone` - (Required) Unique ID identifying the transport zone for this endpoint. + * `transport_zone_profile` - (Optional) Identifiers of the transport zone profiles associated with this transport zone endpoint on this transport node. * `uplink` - (Optional) Uplink/LAG of VMware vSphere Distributed Switch connected to the HostSwitch. * `uplink_name` - (Required) Uplink name from UplinkHostSwitch profile. * `vds_lag_name` - (Optional) Link Aggregation Group (LAG) name of Virtual Distributed Switch. @@ -131,8 +131,8 @@ The following arguments are supported: * `endpoint` - (Optional) Name of the virtual tunnel endpoint which is preconfigured on this host switch. * `host_switch_id` - (Required) External Id of the preconfigured host switch. * `transport_zone_endpoint` - (Optional) Transport zone endpoints - * `transport_zone_id` - (Required) Unique ID identifying the transport zone for this endpoint. - * `transport_zone_profile_id` - (Optional) Identifiers of the transport zone profiles associated with this transport zone endpoint on this transport node. + * `transport_zone` - (Required) Unique ID identifying the transport zone for this endpoint. + * `transport_zone_profile` - (Optional) Identifiers of the transport zone profiles associated with this transport zone endpoint on this transport node. * `node` - (Optional) * `external_id` - (Optional) ID of the Node. * `fqdn` - (Optional) Fully qualified domain name of the fabric node. @@ -248,7 +248,7 @@ The following arguments are supported: * `ip_mac_pair` - (Required) List of IPs and MACs for transport node host switch virtual tunnel endpoints. * `ip` - (Required) IP address. * `mac` - (Required) MAC address. - * `static_ip_pool_id` - (Optional) IP assignment specification for Static IP Pool. + * `static_ip_pool` - (Optional) IP assignment specification for Static IP Pool. * `named_teaming_policy` - (Optional) The named teaming policy to be used by the remote tunnel endpoint. * `rtep_vlan` - (Required) VLAN id for remote tunnel endpoint.