From 5d5289d71ec077033559919997b98cfbbc531ead Mon Sep 17 00:00:00 2001 From: Kobi Samoray Date: Wed, 29 Nov 2023 20:53:10 +0200 Subject: [PATCH] Revise transport_node host_transport_node As nsxt_policy_transport_node covers host-node, the resource above is required to cover only edge-nodes. Therefore the resource is renamed and non-edge attributes are removed. Also remove redundant attributes from policy_host_transport_node resource. Signed-off-by: Kobi Samoray --- nsxt/provider.go | 2 +- ...o => resource_nsxt_edge_transport_node.go} | 937 +++++------------- ...esource_nsxt_policy_host_transport_node.go | 92 +- ...nsxt_policy_host_transport_node_profile.go | 9 +- website/docs/d/compute_manager.html.markdown | 2 +- .../transport_node_realization.html.markdown | 43 +- .../docs/r/edge_transport_node.html.markdown | 155 +++ .../policy_host_transport_node.html.markdown | 49 +- ..._host_transport_node_profile.html.markdown | 29 +- website/docs/r/transport_node.html.markdown | 274 ----- 10 files changed, 484 insertions(+), 1108 deletions(-) rename nsxt/{resource_nsxt_transport_node.go => resource_nsxt_edge_transport_node.go} (63%) create mode 100644 website/docs/r/edge_transport_node.html.markdown delete mode 100644 website/docs/r/transport_node.html.markdown diff --git a/nsxt/provider.go b/nsxt/provider.go index a9e32d188..c8e40b270 100644 --- a/nsxt/provider.go +++ b/nsxt/provider.go @@ -430,7 +430,7 @@ func Provider() *schema.Provider { "nsxt_policy_uplink_host_switch_profile": resourceNsxtUplinkHostSwitchProfile(), "nsxt_node_user": resourceNsxtUsers(), "nsxt_principle_identity": resourceNsxtPrincipleIdentity(), - "nsxt_transport_node": resourceNsxtTransportNode(), + "nsxt_edge_transport_node": resourceNsxtEdgeTransportNode(), "nsxt_failure_domain": resourceNsxtFailureDomain(), "nsxt_cluster_virtual_ip": resourceNsxtClusterVirualIP(), "nsxt_policy_host_transport_node_profile": resourceNsxtPolicyHostTransportNodeProfile(), diff --git a/nsxt/resource_nsxt_transport_node.go b/nsxt/resource_nsxt_edge_transport_node.go similarity index 63% rename from nsxt/resource_nsxt_transport_node.go rename to nsxt/resource_nsxt_edge_transport_node.go index aab380371..a79d1d398 100644 --- a/nsxt/resource_nsxt_transport_node.go +++ b/nsxt/resource_nsxt_edge_transport_node.go @@ -20,10 +20,12 @@ import ( var ipAssignmentTypes = []string{ "assigned_by_dhcp", "static_ip_list", - "static_ip_mac", "static_ip_pool", } +const nodeTypeEdge = "EdgeNode" +const nodeTypeHost = "HostNode" + var hostSwitchModeValues = []string{ model.StandardHostSwitch_HOST_SWITCH_MODE_STANDARD, model.StandardHostSwitch_HOST_SWITCH_MODE_ENS, @@ -31,11 +33,6 @@ var hostSwitchModeValues = []string{ model.StandardHostSwitch_HOST_SWITCH_MODE_LEGACY, } -var hostSwitchTypeValues = []string{ - model.StandardHostSwitch_HOST_SWITCH_TYPE_NVDS, - model.StandardHostSwitch_HOST_SWITCH_TYPE_VDS, -} - var edgeNodeFormFactorValues = []string{ model.EdgeNodeDeploymentConfig_FORM_FACTOR_SMALL, model.EdgeNodeDeploymentConfig_FORM_FACTOR_MEDIUM, @@ -69,25 +66,12 @@ var syslogProtocolValues = []string{ model.SyslogConfiguration_PROTOCOL_LI_TLS, } -var hostNodeOsTypeValues = []string{ - model.HostNode_OS_TYPE_ESXI, - model.HostNode_OS_TYPE_RHELSERVER, - model.HostNode_OS_TYPE_WINDOWSSERVER, - model.HostNode_OS_TYPE_RHELCONTAINER, - model.HostNode_OS_TYPE_UBUNTUSERVER, - model.HostNode_OS_TYPE_HYPERV, - model.HostNode_OS_TYPE_CENTOSSERVER, - model.HostNode_OS_TYPE_CENTOSCONTAINER, - model.HostNode_OS_TYPE_SLESSERVER, - model.HostNode_OS_TYPE_OELSERVER, -} - -func resourceNsxtTransportNode() *schema.Resource { +func resourceNsxtEdgeTransportNode() *schema.Resource { return &schema.Resource{ - Create: resourceNsxtTransportNodeCreate, - Read: resourceNsxtTransportNodeRead, - Update: resourceNsxtTransportNodeUpdate, - Delete: resourceNsxtTransportNodeDelete, + Create: resourceNsxtEdgeTransportNodeCreate, + Read: resourceNsxtEdgeTransportNodeRead, + Update: resourceNsxtEdgeTransportNodeUpdate, + Delete: resourceNsxtEdgeTransportNodeDelete, Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, }, @@ -103,13 +87,32 @@ func resourceNsxtTransportNode() *schema.Resource { Description: "Id of the failure domain", }, // host_switch_spec - "standard_host_switch": getStandardHostSwitchSchema(), - "preconfigured_host_switch": getPreconfiguredHostSwitchSchema(), + "standard_host_switch": getStandardHostSwitchSchema(nodeTypeEdge), + // node_deployment_info - "node": getNodeSchema(map[string]*schema.Schema{}, true), - "edge_node": getEdgeNodeSchema(), - "host_node": getHostNodeSchema(), - "public_cloud_gateway_node": getPublicCloudGatewayNodeSchema(), + "deployment_config": getEdgeNodeDeploymentConfigSchema(), + "node_settings": getEdgeNodeSettingsSchema(), + "external_id": { + Type: schema.TypeString, + Optional: true, + Computed: true, + Description: "ID of the Node", + }, + "fqdn": { + Type: schema.TypeString, + Computed: true, + Description: "Fully qualified domain name of the fabric node", + }, + "id": getNsxIDSchema(), + "ip_addresses": { + Type: schema.TypeList, + Optional: true, + Computed: true, + Description: "IP Addresses of the Node, version 4 or 6", + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, "remote_tunnel_endpoint": { Type: schema.TypeList, @@ -142,50 +145,6 @@ func resourceNsxtTransportNode() *schema.Resource { } } -func getNodeSchema(addlAttributes map[string]*schema.Schema, addExactlyOneOf bool) *schema.Schema { - elemSchema := map[string]*schema.Schema{ - "external_id": { - Type: schema.TypeString, - Optional: true, - Computed: true, - Description: "ID of the Node", - }, - "fqdn": { - Type: schema.TypeString, - Computed: true, - Description: "Fully qualified domain name of the fabric node", - }, - "id": getNsxIDSchema(), - "ip_addresses": { - Type: schema.TypeList, - Optional: true, - Computed: true, - Description: "IP Addresses of the Node, version 4 or 6", - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, - } - - maps.Copy(elemSchema, addlAttributes) - s := schema.Schema{ - Type: schema.TypeList, - MaxItems: 1, - Optional: true, - Elem: &schema.Resource{ - Schema: elemSchema, - }, - } - if addExactlyOneOf { - s.ExactlyOneOf = []string{ - "edge_node", - "host_node", - "public_cloud_gateway_node", - } - } - return &s -} - func getEdgeNodeDeploymentConfigSchema() *schema.Schema { return &schema.Schema{ Type: schema.TypeList, @@ -480,154 +439,21 @@ func getEdgeNodeSettingsSchema() *schema.Schema { } } -func getEdgeNodeSchema() *schema.Schema { - s := map[string]*schema.Schema{ - "deployment_config": getEdgeNodeDeploymentConfigSchema(), - "node_settings": getEdgeNodeSettingsSchema(), - } - return getNodeSchema(s, false) -} - -func getSharedHostNodeSchemaAttrs() map[string]*schema.Schema { - return map[string]*schema.Schema{ - "host_credential": { - Type: schema.TypeList, - MaxItems: 1, - Description: "Host login credentials", - Optional: true, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "password": { - Type: schema.TypeString, - Sensitive: true, - Required: true, - Description: "The authentication password of the host node", - }, - "thumbprint": { - Type: schema.TypeString, - Optional: true, - Description: "ESXi thumbprint or SSH key fingerprint of the host node", - }, - "username": { - Type: schema.TypeString, - Required: true, - Description: "The username of the account on the host node", - }, - }, - }, - }, - "os_type": { - Type: schema.TypeString, - Required: true, - Description: "Hypervisor OS type", - ValidateFunc: validation.StringInSlice(hostNodeOsTypeValues, false), - }, - "os_version": { - Type: schema.TypeString, - Optional: true, - Description: "Hypervisor OS version", - }, - "windows_install_location": { - Type: schema.TypeString, - Optional: true, - Default: "C:\\Program Files\\VMware\\NSX\\", - Description: "Install location of Windows Server on baremetal being managed by NSX", - }, - } -} - -func getHostNodeSchema() *schema.Schema { - s := getSharedHostNodeSchemaAttrs() - return getNodeSchema(s, false) -} - -func getPublicCloudGatewayNodeSchema() *schema.Schema { - s := map[string]*schema.Schema{ - "deployment_config": getEdgeNodeDeploymentConfigSchema(), - "node_settings": getEdgeNodeSettingsSchema(), - } - return getNodeSchema(s, false) -} - -func getPreconfiguredHostSwitchSchema() *schema.Schema { - return &schema.Schema{ - Type: schema.TypeList, - Optional: true, - Description: "Preconfigured host switch", - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "endpoint": { - Type: schema.TypeString, - Description: "Name of the virtual tunnel endpoint", - Optional: true, - }, - "host_switch_id": { - Type: schema.TypeString, - Description: "External Id of the preconfigured host switch", - Required: true, - }, - "transport_zone_endpoint": getTransportZoneEndpointSchema(), - }, - }, - } -} - -func getStandardHostSwitchSchema() *schema.Schema { - return &schema.Schema{ +func getStandardHostSwitchSchema(nodeType string) *schema.Schema { + s := schema.Schema{ Type: schema.TypeList, - Optional: true, + Required: true, Description: "Standard host switch specification", - ExactlyOneOf: []string{ - "preconfigured_host_switch", - }, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "cpu_config": { - Type: schema.TypeList, - Description: "Enhanced Networking Stack enabled HostSwitch CPU configuration", - Optional: true, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "num_lcores": { - Type: schema.TypeInt, - Required: true, - Description: "Number of Logical cpu cores (Lcores) to be placed on a specified NUMA node", - }, - "numa_node_index": { - Type: schema.TypeInt, - Required: true, - Description: "Unique index of the Non Uniform Memory Access (NUMA) node", - }, - }, - }, - }, "host_switch_id": { 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, - Description: "Operational mode of a HostSwitch", - Default: model.StandardHostSwitch_HOST_SWITCH_MODE_STANDARD, - Optional: true, - ValidateFunc: validation.StringInSlice(hostSwitchModeValues, false), - }, "host_switch_profile": getHostSwitchProfileIDsSchema(), - "host_switch_type": { - Type: schema.TypeString, - Description: "Type of HostSwitch", - Optional: true, - Default: model.StandardHostSwitch_HOST_SWITCH_TYPE_NVDS, - ValidateFunc: validation.StringInSlice(hostSwitchTypeValues, false), - }, - "ip_assignment": getIPAssignmentSchema(), - "is_migrate_pnics": { - Type: schema.TypeBool, - Description: "Migrate any pnics which are in use", - Optional: true, - }, + "ip_assignment": getIPAssignmentSchema(), "pnic": { Type: schema.TypeList, Optional: true, @@ -647,68 +473,81 @@ func getStandardHostSwitchSchema() *schema.Schema { }, }, }, - "portgroup_transport_zone": { - Type: schema.TypeString, - Optional: true, - Description: "Transport Zone ID representing the DVS used in NSX on DVPG", - }, - "transport_node_profile_sub_config": { - Type: schema.TypeList, - MaxItems: 16, - Optional: true, - Description: "Transport Node Profile sub-configuration Options", - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "host_switch_config_option": { - Type: schema.TypeList, - MaxItems: 1, - Required: true, - Description: "Subset of the host switch configuration", - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "host_switch_id": { - Type: schema.TypeString, - Optional: true, - Description: "The host switch id. This ID will be used to reference a host switch", - }, - "host_switch_profile": getHostSwitchProfileIDsSchema(), - "ip_assignment": getIPAssignmentSchema(), - "uplink": getUplinksSchema(), + "transport_zone_endpoint": getTransportZoneEndpointSchema(), + }, + }, + } + if nodeType == nodeTypeHost { + elemSchema := s.Elem.(*schema.Resource).Schema + maps.Copy(elemSchema, map[string]*schema.Schema{ + "host_switch_mode": { + Type: schema.TypeString, + Description: "Operational mode of a HostSwitch", + Default: model.StandardHostSwitch_HOST_SWITCH_MODE_STANDARD, + Optional: true, + ValidateFunc: validation.StringInSlice(hostSwitchModeValues, false), + }, + "is_migrate_pnics": { + Type: schema.TypeBool, + Description: "Migrate any pnics which are in use", + Optional: true, + }, + "transport_node_profile_sub_config": { + Type: schema.TypeList, + MaxItems: 16, + Optional: true, + Description: "Transport Node Profile sub-configuration Options", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "host_switch_config_option": { + Type: schema.TypeList, + MaxItems: 1, + Required: true, + Description: "Subset of the host switch configuration", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "host_switch_id": { + Type: schema.TypeString, + Optional: true, + Description: "The host switch id. This ID will be used to reference a host switch", }, + "host_switch_profile": getHostSwitchProfileIDsSchema(), + "ip_assignment": getIPAssignmentSchema(), + "uplink": getUplinksSchema(), }, }, - "name": { - Type: schema.TypeString, - Required: true, - Description: "Name of the transport node profile config option", - }, + }, + "name": { + Type: schema.TypeString, + Required: true, + Description: "Name of the transport node profile config option", }, }, }, - "transport_zone_endpoint": getTransportZoneEndpointSchema(), - "uplink": getUplinksSchema(), - "vmk_install_migration": { - Type: schema.TypeList, - Description: "The vmknic and logical switch mappings", - Optional: true, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "destination_network": { - Type: schema.TypeString, - Required: true, - Description: "The network id to which the ESX vmk interface will be migrated", - }, - "device_name": { - Type: schema.TypeString, - Required: true, - Description: "ESX vmk interface name", - }, + }, + "uplink": getUplinksSchema(), + "vmk_install_migration": { + Type: schema.TypeList, + Description: "The vmknic and logical switch mappings", + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "destination_network": { + Type: schema.TypeString, + Required: true, + Description: "The network id to which the ESX vmk interface will be migrated", + }, + "device_name": { + Type: schema.TypeString, + Required: true, + Description: "ESX vmk interface name", }, }, }, }, - }, + }) } + return &s } func getTransportZoneEndpointSchema() *schema.Schema { @@ -723,7 +562,7 @@ func getTransportZoneEndpointSchema() *schema.Schema { Required: true, Description: "Unique ID identifying the transport zone for this endpoint", }, - "transport_zone_profile": { + "transport_zone_profiles": { Type: schema.TypeList, Optional: true, Computed: true, @@ -821,50 +660,6 @@ func getIPAssignmentSchema() *schema.Schema { }, }, }, - "static_ip_mac": { - Type: schema.TypeList, - MaxItems: 1, - Optional: true, - Description: "IP and MAC assignment specification for Static IP List", - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "default_gateway": { - Type: schema.TypeString, - Required: true, - Description: "Gateway IP", - ValidateFunc: validateSingleIP(), - }, - "ip_mac_pair": { - Type: schema.TypeList, - Description: "List of IPs and MACs for transport node host switch virtual tunnel endpoints", - MinItems: 1, - Required: true, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "ip": { - Type: schema.TypeString, - Required: true, - Description: "IP address", - ValidateFunc: validateSingleIP(), - }, - "mac": { - Type: schema.TypeString, - Optional: true, - Description: "MAC address", - ValidateFunc: validation.IsMACAddress, - }, - }, - }, - }, - "subnet_mask": { - Type: schema.TypeString, - Required: true, - Description: "Subnet mask", - ValidateFunc: validateSingleIP(), - }, - }, - }, - }, "static_ip_pool": { Type: schema.TypeString, Optional: true, @@ -880,14 +675,45 @@ func getTransportNodeFromSchema(d *schema.ResourceData) (*model.TransportNode, e displayName := d.Get("display_name").(string) tags := getMPTagsFromSchema(d) failureDomain := d.Get("failure_domain").(string) - hostSwitchSpec, err := getHostSwitchSpecFromSchema(d) + hostSwitchSpec, err := getHostSwitchSpecFromSchema(d, nodeTypeEdge) if err != nil { return nil, fmt.Errorf("failed to create Transport Node: %v", err) } - nodeDeploymentInfo, err := getNodeDeploymentInfoFromSchema(d) + + converter := bindings.NewTypeConverter() + var dataValue data.DataValue + var errs []error + + externalID := d.Get("external_id").(string) + fqdn := d.Get("fqdn").(string) + id := d.Get("id").(string) + ipAddresses := interfaceListToStringList(d.Get("ip_addresses").([]interface{})) + + deploymentConfig, err := getEdgeNodeDeploymentConfigFromSchema(d.Get("deployment_config")) if err != nil { - return nil, fmt.Errorf("failed to create Transport Node: %v", err) + return nil, err + } + nodeSettings, err := getEdgeNodeSettingsFromSchema(d.Get("node_settings")) + if err != nil { + return nil, err + } + node := model.EdgeNode{ + ExternalId: &externalID, + Fqdn: &fqdn, + Id: &id, + IpAddresses: ipAddresses, + DeploymentConfig: deploymentConfig, + NodeSettings: nodeSettings, + ResourceType: model.EdgeNode__TYPE_IDENTIFIER, } + dataValue, errs = converter.ConvertToVapi(node, model.EdgeNodeBindingType()) + + if errs != nil { + log.Printf("Failed to convert node object, errors are %v", errs) + return nil, errs[0] + } + nodeDeploymentInfo := dataValue.(*data.StructValue) + remoteTunnelEndpoint, err := getRemoteTunnelEndpointFromSchema(d) if err != nil { return nil, fmt.Errorf("failed to create Transport Node: %v", err) @@ -905,7 +731,7 @@ func getTransportNodeFromSchema(d *schema.ResourceData) (*model.TransportNode, e return &obj, nil } -func resourceNsxtTransportNodeCreate(d *schema.ResourceData, m interface{}) error { +func resourceNsxtEdgeTransportNodeCreate(d *schema.ResourceData, m interface{}) error { connector := getPolicyConnector(m) client := nsx.NewTransportNodesClient(connector) @@ -922,7 +748,7 @@ func resourceNsxtTransportNodeCreate(d *schema.ResourceData, m interface{}) erro } d.SetId(*obj1.Id) - return resourceNsxtTransportNodeRead(d, m) + return resourceNsxtEdgeTransportNodeRead(d, m) } func getRemoteTunnelEndpointFromSchema(d *schema.ResourceData) (*model.TransportNodeRemoteTunnelEndpointConfig, error) { @@ -1052,111 +878,6 @@ func getEdgeNodeDeploymentConfigFromSchema(cfg interface{}) (*model.EdgeNodeDepl return nil, nil } -func getNodeDeploymentInfoFromSchema(d *schema.ResourceData) (*data.StructValue, error) { - converter := bindings.NewTypeConverter() - var dataValue data.DataValue - var errs []error - - for _, nodeType := range []string{"edge_node", "host_node", "node", "public_cloud_gateway_node"} { - for _, ni := range d.Get(nodeType).([]interface{}) { - nodeInfo := ni.(map[string]interface{}) - externalID := nodeInfo["external_id"].(string) - fqdn := nodeInfo["fqdn"].(string) - id := nodeInfo["id"].(string) - ipAddresses := interfaceListToStringList(nodeInfo["ip_addresses"].([]interface{})) - - switch nodeType { - case "edge_node": - deploymentConfig, err := getEdgeNodeDeploymentConfigFromSchema(nodeInfo["deployment_config"]) - if err != nil { - return nil, err - } - nodeSettings, err := getEdgeNodeSettingsFromSchema(nodeInfo["node_settings"]) - if err != nil { - return nil, err - } - node := model.EdgeNode{ - ExternalId: &externalID, - Fqdn: &fqdn, - Id: &id, - IpAddresses: ipAddresses, - DeploymentConfig: deploymentConfig, - NodeSettings: nodeSettings, - ResourceType: model.EdgeNode__TYPE_IDENTIFIER, - } - dataValue, errs = converter.ConvertToVapi(node, model.EdgeNodeBindingType()) - - case "host_node": - var hostCredential *model.HostNodeLoginCredential - for _, hci := range nodeInfo["host_credential"].([]interface{}) { - hc := hci.(map[string]interface{}) - password := hc["password"].(string) - thumbprint := hc["thumbprint"].(string) - username := hc["username"].(string) - hostCredential = &model.HostNodeLoginCredential{ - Password: &password, - Thumbprint: &thumbprint, - Username: &username, - } - } - osType := nodeInfo["os_type"].(string) - osVersion := nodeInfo["os_version"].(string) - windowsInstallLocation := nodeInfo["windows_install_location"].(string) - - node := model.HostNode{ - ExternalId: &externalID, - Fqdn: &fqdn, - Id: &id, - IpAddresses: ipAddresses, - HostCredential: hostCredential, - OsType: &osType, - OsVersion: &osVersion, - WindowsInstallLocation: &windowsInstallLocation, - ResourceType: model.HostNode__TYPE_IDENTIFIER, - } - dataValue, errs = converter.ConvertToVapi(node, model.HostNodeBindingType()) - - case "node": - node := model.Node{ - ExternalId: &externalID, - Fqdn: &fqdn, - Id: &id, - IpAddresses: ipAddresses, - ResourceType: model.Node__TYPE_IDENTIFIER, - } - dataValue, errs = converter.ConvertToVapi(node, model.NodeBindingType()) - - case "public_cloud_gateway_node": - deploymentConfig, err := getEdgeNodeDeploymentConfigFromSchema(nodeInfo["deployment_config"]) - if err != nil { - return nil, err - } - nodeSettings, err := getEdgeNodeSettingsFromSchema(nodeInfo["node_settings"]) - if err != nil { - return nil, err - } - node := model.PublicCloudGatewayNode{ - ExternalId: &externalID, - Fqdn: &fqdn, - Id: &id, - IpAddresses: ipAddresses, - DeploymentConfig: deploymentConfig, - NodeSettings: nodeSettings, - ResourceType: "PublicCloudGatewayNode", // No const for this in model?! - } - dataValue, errs = converter.ConvertToVapi(node, model.PublicCloudGatewayNodeBindingType()) - } - } - } - if errs != nil { - log.Printf("Failed to convert node object, errors are %v", errs) - return nil, errs[0] - } else if dataValue != nil { - return dataValue.(*data.StructValue), nil - } - return nil, nil -} - func getEdgeNodeSettingsFromSchema(s interface{}) (*model.EdgeNodeSettings, error) { if s == nil { return nil, nil @@ -1213,21 +934,6 @@ func getEdgeNodeSettingsFromSchema(s interface{}) (*model.EdgeNodeSettings, erro return nil, nil } -func getCPUConfigFromSchema(cpuConfigList []interface{}) []model.CpuCoreConfigForEnhancedNetworkingStackSwitch { - var cpuConfig []model.CpuCoreConfigForEnhancedNetworkingStackSwitch - for _, cc := range cpuConfigList { - data := cc.(map[string]interface{}) - numLCores := int64(data["num_lcores"].(int)) - numaNodeIndex := int64(data["numa_node_index"].(int)) - elem := model.CpuCoreConfigForEnhancedNetworkingStackSwitch{ - NumLcores: &numLCores, - NumaNodeIndex: &numaNodeIndex, - } - cpuConfig = append(cpuConfig, elem) - } - return cpuConfig -} - func getHostSwitchProfileIDsFromSchema(hswProfileList []interface{}) []model.HostSwitchProfileTypeIdEntry { var hswProfiles []model.HostSwitchProfileTypeIdEntry for _, hswp := range hswProfileList { @@ -1283,32 +989,6 @@ func getIPAssignmentFromSchema(ipAssignmentList interface{}) (*data.StructValue, break } - case "static_ip_mac": - for _, iad := range iaData.([]interface{}) { - data := iad.(map[string]interface{}) - defaultGateway := data["default_gateway"].(string) - subnetMask := data["subnet_mask"].(string) - var ipMacList []model.IpMacPair - for _, ipmi := range data["ip_mac_pair"].([]interface{}) { - ipm := ipmi.(map[string]interface{}) - ip := ipm["ip"].(string) - mac := ipm["mac"].(string) - el := model.IpMacPair{ - Ip: &ip, - Mac: &mac, - } - ipMacList = append(ipMacList, el) - } - elem := model.StaticIpMacListSpec{ - DefaultGateway: &defaultGateway, - SubnetMask: &subnetMask, - IpMacList: ipMacList, - ResourceType: model.IpAssignmentSpec_RESOURCE_TYPE_STATICIPMACLISTSPEC, - } - dataValue, errs = converter.ConvertToVapi(elem, model.StaticIpMacListSpecBindingType()) - break - } - case "static_ip_pool": staticIPPoolID := iaData.(string) elem := model.StaticIpPoolSpec{ @@ -1368,22 +1048,31 @@ func getIPAssignmentData(data map[string]interface{}) (string, interface{}, erro return t, d, nil } -func getHostSwitchSpecFromSchema(d *schema.ResourceData) (*data.StructValue, error) { +func getHostSwitchSpecFromSchema(d *schema.ResourceData, nodeType string) (*data.StructValue, error) { var dataValue data.DataValue var errs []error + var hsList []model.StandardHostSwitch converter := bindings.NewTypeConverter() standardSwitchList := d.Get("standard_host_switch").([]interface{}) for _, swEntry := range standardSwitchList { swData := swEntry.(map[string]interface{}) - cpuConfig := getCPUConfigFromSchema(swData["cpu_config"].([]interface{})) hostSwitchID := swData["host_switch_id"].(string) - hostSwitchMode := swData["host_switch_mode"].(string) + var hostSwitchMode, hostSwitchType string + var isMigratePNics bool + var uplinks []model.VdsUplink + if nodeType == nodeTypeHost { + hostSwitchMode = swData["host_switch_mode"].(string) + hostSwitchType = model.StandardHostSwitch_HOST_SWITCH_TYPE_VDS + isMigratePNics = swData["is_migrate_pnics"].(bool) + uplinks = getUplinksFromSchema(swData["uplink"].([]interface{})) + } else if nodeType == nodeTypeEdge { + hostSwitchMode = model.StandardHostSwitch_HOST_SWITCH_MODE_STANDARD + hostSwitchType = model.StandardHostSwitch_HOST_SWITCH_TYPE_NVDS + } 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) var pNics []model.Pnic for _, p := range swData["pnic"].([]interface{}) { data := p.(map[string]interface{}) @@ -1398,63 +1087,34 @@ 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"].(string) - transportNodeSubProfileCfg := getTransportNodeSubProfileCfg(swData["transport_node_profile_sub_configs"]) + var transportNodeSubProfileCfg []model.TransportNodeProfileSubConfig + if nodeType == nodeTypeHost { + transportNodeSubProfileCfg = getTransportNodeSubProfileCfg(swData["transport_node_profile_sub_configs"]) + } transportZoneEndpoints := getTransportZoneEndpointsFromSchema(swData["transport_zone_endpoint"].([]interface{})) - uplinks := getUplinksFromSchema(swData["uplink"].([]interface{})) hsw := model.StandardHostSwitch{ - CpuConfig: cpuConfig, - HostSwitchId: &hostSwitchID, - HostSwitchMode: &hostSwitchMode, - HostSwitchProfileIds: hostSwitchProfileIDs, - HostSwitchType: &hostSwitchType, - IpAssignmentSpec: iPAssignmentSpec, - IsMigratePnics: &isMigratePNics, - Pnics: pNics, - TransportNodeProfileSubConfigs: transportNodeSubProfileCfg, - TransportZoneEndpoints: transportZoneEndpoints, - Uplinks: uplinks, + HostSwitchId: &hostSwitchID, + HostSwitchMode: &hostSwitchMode, + HostSwitchProfileIds: hostSwitchProfileIDs, + HostSwitchType: &hostSwitchType, + IpAssignmentSpec: iPAssignmentSpec, + Pnics: pNics, + TransportZoneEndpoints: transportZoneEndpoints, } - if portGroupTZID != "" { - hsw.PortgroupTransportZoneId = &portGroupTZID - + if nodeType == nodeTypeHost { + hsw.IsMigratePnics = &isMigratePNics + hsw.TransportNodeProfileSubConfigs = transportNodeSubProfileCfg + hsw.Uplinks = uplinks } - hostSwitchSpec := model.StandardHostSwitchSpec{ - HostSwitches: []model.StandardHostSwitch{hsw}, - ResourceType: model.HostSwitchSpec_RESOURCE_TYPE_STANDARDHOSTSWITCHSPEC, - } - dataValue, errs = converter.ConvertToVapi(hostSwitchSpec, model.StandardHostSwitchSpecBindingType()) + hsList = append(hsList, hsw) } - - preconfiguredSwitchList := d.Get("preconfigured_host_switch").([]interface{}) - for _, swEntry := range preconfiguredSwitchList { - swData := swEntry.(map[string]interface{}) - - var endpoints []model.PreconfiguredEndpoint - endpoint := swData["endpoint"].(string) - if endpoint != "" { - elem := model.PreconfiguredEndpoint{ - DeviceName: &endpoint, - } - endpoints = append(endpoints, elem) - } - - hostSwitchID := swData["host_switch_id"].(string) - tzEndpoints := getTransportZoneEndpointsFromSchema(swData["transport_zone_endpoint"].([]interface{})) - - hsw := model.PreconfiguredHostSwitch{ - Endpoints: endpoints, - HostSwitchId: &hostSwitchID, - TransportZoneEndpoints: tzEndpoints, - } - hostSwitchSpec := model.PreconfiguredHostSwitchSpec{ - HostSwitches: []model.PreconfiguredHostSwitch{hsw}, - ResourceType: model.HostSwitchSpec_RESOURCE_TYPE_PRECONFIGUREDHOSTSWITCHSPEC, - } - dataValue, errs = converter.ConvertToVapi(hostSwitchSpec, model.PreconfiguredHostSwitchSpecBindingType()) + hostSwitchSpec := model.StandardHostSwitchSpec{ + HostSwitches: hsList, + ResourceType: model.HostSwitchSpec_RESOURCE_TYPE_STANDARDHOSTSWITCHSPEC, } + dataValue, errs = converter.ConvertToVapi(hostSwitchSpec, model.StandardHostSwitchSpecBindingType()) if errs != nil { return nil, errs[0] @@ -1470,8 +1130,8 @@ func getTransportZoneEndpointsFromSchema(endpointList []interface{}) []model.Tra data := endpoint.(map[string]interface{}) transportZoneID := data["transport_zone"].(string) var transportZoneProfileIDs []model.TransportZoneProfileTypeIdEntry - if data["transport_zone_profile"] != nil { - for _, tzpID := range data["transport_zone_profile"].([]interface{}) { + if data["transport_zone_profiles"] != nil { + for _, tzpID := range data["transport_zone_profiles"].([]interface{}) { profileID := tzpID.(string) resourceType := model.TransportZoneProfileTypeIdEntry_RESOURCE_TYPE_BFDHEALTHMONITORINGPROFILE elem := model.TransportZoneProfileTypeIdEntry{ @@ -1541,7 +1201,7 @@ func getTransportNodeSubProfileCfg(iface interface{}) []model.TransportNodeProfi return cfgList } -func resourceNsxtTransportNodeRead(d *schema.ResourceData, m interface{}) error { +func resourceNsxtEdgeTransportNodeRead(d *schema.ResourceData, m interface{}) error { connector := getPolicyConnector(m) id := d.Id() if id == "" { @@ -1559,11 +1219,35 @@ func resourceNsxtTransportNodeRead(d *schema.ResourceData, m interface{}) error d.Set("display_name", obj.DisplayName) setMPTagsInSchema(d, obj.Tags) d.Set("failure_domain", obj.FailureDomainId) - err = setHostSwitchSpecInSchema(d, obj.HostSwitchSpec) + + err = setHostSwitchSpecInSchema(d, obj.HostSwitchSpec, nodeTypeEdge) + if err != nil { + return handleReadError(d, "TransportNode", id, err) + } + + converter := bindings.NewTypeConverter() + base, errs := converter.ConvertToGolang(obj.NodeDeploymentInfo, model.EdgeNodeBindingType()) + if errs != nil { + return handleReadError(d, "TransportNode", id, errs[0]) + } + node := base.(model.EdgeNode) + + err = setEdgeDeploymentConfigInSchema(d, node.DeploymentConfig) if err != nil { return handleReadError(d, "TransportNode", id, err) } - err = setNodeDeploymentInfoInSchema(d, obj.NodeDeploymentInfo) + + err = setEdgeNodeSettingsInSchema(d, node.NodeSettings) + if err != nil { + return handleReadError(d, "TransportNode", id, err) + } + + // Set base object attributes + d.Set("external_id", node.ExternalId) + d.Set("fqdn", node.Fqdn) + d.Set("id", node.Id) + d.Set("ip_addresses", node.IpAddresses) + if err != nil { return handleReadError(d, "TransportNode", id, err) } @@ -1583,102 +1267,8 @@ func resourceNsxtTransportNodeRead(d *schema.ResourceData, m interface{}) error return nil } -func setNodeDeploymentInfoInSchema(d *schema.ResourceData, info *data.StructValue) error { - converter := bindings.NewTypeConverter() - base, errs := converter.ConvertToGolang(info, model.NodeBindingType()) - if errs != nil { - return errs[0] - } - node := base.(model.Node) - var elem map[string]interface{} - - nodeType := node.ResourceType - - switch nodeType { - case model.Node__TYPE_IDENTIFIER: - elem = getElemOrEmptyMapFromSchema(d, "node") - d.Set("node", []interface{}{elem}) - case model.EdgeNode__TYPE_IDENTIFIER: - elem = getElemOrEmptyMapFromSchema(d, "edge_node") - - base, errs := converter.ConvertToGolang(info, model.EdgeNodeBindingType()) - if errs != nil { - return errs[0] - } - node := base.(model.EdgeNode) - - var depCfg map[string]interface{} - if elem["deployment_config"] != nil && elem["deployment_config"].([]interface{}) != nil { - depCfg = elem["deployment_config"].([]interface{})[0].(map[string]interface{}) - } else { - depCfg = make(map[string]interface{}) - } - err := setEdgeDeploymentConfigInSchema(depCfg, node.DeploymentConfig) - elem["deployment_config"] = []interface{}{depCfg} - - if err != nil { - return err - } - elem["node_settings"] = setEdgeNodeSettingsInSchema(node.NodeSettings) - d.Set("edge_node", []interface{}{elem}) - - case model.HostNode__TYPE_IDENTIFIER: - elem = getElemOrEmptyMapFromSchema(d, "host_node") - - base, errs := converter.ConvertToGolang(info, model.HostNodeBindingType()) - if errs != nil { - return errs[0] - } - node := base.(model.HostNode) - hostCredential := make(map[string]interface{}) - // Note: password attribute is sensitive and is not returned by NSX - hostCredential["thumbprint"] = node.HostCredential.Thumbprint - hostCredential["username"] = node.HostCredential.Username - elem["host_credential"] = []map[string]interface{}{hostCredential} - - elem["os_type"] = node.OsType - elem["os_version"] = node.OsVersion - elem["windows_install_location"] = node.WindowsInstallLocation - d.Set("host_node", []interface{}{elem}) - - case "PublicCloudGatewayNode": - // Awkwardly, no const for PublicCloudGatewayNode in SDK - elem = getElemOrEmptyMapFromSchema(d, "public_cloud_gateway_node") - - base, errs := converter.ConvertToGolang(info, model.PublicCloudGatewayNodeBindingType()) - if errs != nil { - return errs[0] - } - node := base.(model.PublicCloudGatewayNode) - - var depCfg map[string]interface{} - if elem["deployment_config"] != nil { - depCfgList := elem["deployment_config"].([]interface{}) - depCfg = depCfgList[0].(map[string]interface{}) - } else { - depCfg = make(map[string]interface{}) - } - err := setEdgeDeploymentConfigInSchema(depCfg, node.DeploymentConfig) - elem["deployment_config"] = []interface{}{depCfg} - - if err != nil { - return err - } - elem["node_settings"] = setEdgeNodeSettingsInSchema(node.NodeSettings) - d.Set("public_cloud_gateway_node", []interface{}{elem}) - } - - // Set base object attributes - elem["external_id"] = node.ExternalId - elem["fqdn"] = node.Fqdn - elem["id"] = node.Id - elem["ip_addresses"] = node.IpAddresses - - return nil -} - -func setEdgeNodeSettingsInSchema(nodeSettings *model.EdgeNodeSettings) interface{} { - elem := make(map[string]interface{}) +func setEdgeNodeSettingsInSchema(d *schema.ResourceData, nodeSettings *model.EdgeNodeSettings) error { + elem := getElemOrEmptyMapFromSchema(d, "node_settings") var advCfg []map[string]interface{} for _, kv := range nodeSettings.AdvancedConfiguration { e := make(map[string]interface{}) @@ -1705,11 +1295,13 @@ func setEdgeNodeSettingsInSchema(nodeSettings *model.EdgeNodeSettings) interface syslogServers = append(syslogServers, e) } elem["syslog_server"] = syslogServers - return []map[string]interface{}{elem} + d.Set("node_settings", []map[string]interface{}{elem}) + return nil } -func setEdgeDeploymentConfigInSchema(elem map[string]interface{}, deploymentConfig *model.EdgeNodeDeploymentConfig) error { +func setEdgeDeploymentConfigInSchema(d *schema.ResourceData, deploymentConfig *model.EdgeNodeDeploymentConfig) error { var err error + elem := getElemOrEmptyMapFromSchema(d, "deployment_config") elem["form_factor"] = deploymentConfig.FormFactor var nodeUserSettings map[string]interface{} @@ -1729,6 +1321,8 @@ func setEdgeDeploymentConfigInSchema(elem map[string]interface{}, deploymentConf if err != nil { return err } + d.Set("deployment_config", []map[string]interface{}{elem}) + return nil } @@ -1785,7 +1379,7 @@ func setVMDeploymentConfigInSchema(config *data.StructValue) (interface{}, error return []interface{}{elem}, nil } -func setHostSwitchSpecInSchema(d *schema.ResourceData, spec *data.StructValue) error { +func setHostSwitchSpecInSchema(d *schema.ResourceData, spec *data.StructValue, nodeType string) error { converter := bindings.NewTypeConverter() base, errs := converter.ConvertToGolang(spec, model.HostSwitchSpecBindingType()) @@ -1804,18 +1398,8 @@ func setHostSwitchSpecInSchema(d *schema.ResourceData, spec *data.StructValue) e swEntry := entry.(model.StandardHostSwitchSpec) for _, sw := range swEntry.HostSwitches { elem := make(map[string]interface{}) - var cpuConfig []map[string]interface{} - for _, c := range sw.CpuConfig { - e := make(map[string]interface{}) - e["num_lcores"] = c.NumLcores - e["numa_node_index"] = c.NumaNodeIndex - cpuConfig = append(cpuConfig, e) - } - elem["cpu_config"] = cpuConfig elem["host_switch_id"] = sw.HostSwitchId - elem["host_switch_mode"] = sw.HostSwitchMode elem["host_switch_profile"] = setHostSwitchProfileIDsInSchema(sw.HostSwitchProfileIds) - elem["host_switch_type"] = sw.HostSwitchType var err error elem["ip_assignment"], err = setIPAssignmentInSchema(sw.IpAssignmentSpec) if err != nil { @@ -1830,61 +1414,43 @@ func setHostSwitchSpecInSchema(d *schema.ResourceData, spec *data.StructValue) e pnics = append(pnics, e) } elem["pnic"] = pnics - 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"] = setHostSwitchProfileIDsInSchema(tnpsc.HostSwitchConfigOption.HostSwitchProfileIds) - hsCfgOpt["ip_assignment"], err = setIPAssignmentInSchema(tnpsc.HostSwitchConfigOption.IpAssignmentSpec) - if err != nil { - return err + if nodeType == nodeTypeHost { + elem["host_switch_mode"] = sw.HostSwitchMode + elem["uplink"] = setUplinksFromSchema(sw.Uplinks) + 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"] = setHostSwitchProfileIDsInSchema(tnpsc.HostSwitchConfigOption.HostSwitchProfileIds) + hsCfgOpt["ip_assignment"], err = setIPAssignmentInSchema(tnpsc.HostSwitchConfigOption.IpAssignmentSpec) + if err != nil { + return err + } + hsCfgOpt["uplink"] = setUplinksFromSchema(tnpsc.HostSwitchConfigOption.Uplinks) + e["host_switch_config_option"] = hsCfgOpts + e["name"] = tnpsc.Name } - hsCfgOpt["uplink"] = setUplinksFromSchema(tnpsc.HostSwitchConfigOption.Uplinks) - e["host_switch_config_option"] = hsCfgOpts - e["name"] = tnpsc.Name - + elem["transport_node_profile_sub_config"] = tnpSubConfig + + var vmkIMList []map[string]interface{} + for _, vmkIM := range sw.VmkInstallMigration { + e := make(map[string]interface{}) + e["destination_network"] = vmkIM.DestinationNetwork + e["device_name"] = vmkIM.DeviceName + vmkIMList = append(vmkIMList, e) + } + elem["vmk_install_migration"] = vmkIMList } - elem["transport_node_profile_sub_config"] = tnpSubConfig elem["transport_zone_endpoint"] = setTransportZoneEndpointInSchema(sw.TransportZoneEndpoints) - elem["uplink"] = setUplinksFromSchema(sw.Uplinks) - var vmkIMList []map[string]interface{} - for _, vmkIM := range sw.VmkInstallMigration { - e := make(map[string]interface{}) - e["destination_network"] = vmkIM.DestinationNetwork - e["device_name"] = vmkIM.DeviceName - vmkIMList = append(vmkIMList, e) - } - elem["vmk_install_migration"] = vmkIMList swList = append(swList, elem) } d.Set("standard_host_switch", swList) case model.HostSwitchSpec_RESOURCE_TYPE_PRECONFIGUREDHOSTSWITCHSPEC: - var swList []map[string]interface{} - entry, errs := converter.ConvertToGolang(spec, model.PreconfiguredHostSwitchSpecBindingType()) - if errs != nil { - return errs[0] - } - swEntry := entry.(model.PreconfiguredHostSwitchSpec) - for _, sw := range swEntry.HostSwitches { - elem := make(map[string]interface{}) - var endpoints []string - for _, ep := range sw.Endpoints { - endpoints = append(endpoints, *ep.DeviceName) - } - if len(endpoints) > 0 { - elem["endpoint"] = endpoints[0] - } - elem["host_switch_id"] = sw.HostSwitchId - elem["transport_zone_endpoint"] = setTransportZoneEndpointInSchema(sw.TransportZoneEndpoints) - - swList = append(swList, elem) - } - d.Set("preconfigured_host_switch", swList) + return fmt.Errorf("preconfigured host switch is not supported") } return nil } @@ -1898,7 +1464,7 @@ func setTransportZoneEndpointInSchema(endpoints []model.TransportZoneEndPoint) i for _, tzpID := range endpoint.TransportZoneProfileIds { tzpIDs = append(tzpIDs, *tzpID.ProfileId) } - e["transport_zone_profile"] = tzpIDs + e["transport_zone_profiles"] = tzpIDs endpointList = append(endpointList, e) } return endpointList @@ -1942,25 +1508,6 @@ func setIPAssignmentInSchema(spec *data.StructValue) (interface{}, error) { e["subnet_mask"] = ipAsEntry.SubnetMask elem["static_ip"] = []map[string]interface{}{e} - case model.IpAssignmentSpec_RESOURCE_TYPE_STATICIPMACLISTSPEC: - e := make(map[string]interface{}) - entry, errs := converter.ConvertToGolang(spec, model.StaticIpMacListSpecBindingType()) - if errs != nil { - return nil, errs[0] - } - ipAsEntry := entry.(model.StaticIpMacListSpec) - var ipMacList []map[string]interface{} - e["default_gateway"] = ipAsEntry.DefaultGateway - for _, ipMac := range ipAsEntry.IpMacList { - ipMacPair := make(map[string]interface{}) - ipMacPair["ip"] = ipMac.Ip - ipMacPair["mac"] = ipMac.Mac - ipMacList = append(ipMacList, ipMacPair) - } - e["ip_mac_pair"] = ipMacList - e["subnet_mask"] = ipAsEntry.SubnetMask - elem["static_ip_mac"] = []map[string]interface{}{e} - case model.IpAssignmentSpec_RESOURCE_TYPE_STATICIPPOOLSPEC: entry, errs := converter.ConvertToGolang(spec, model.StaticIpPoolSpecBindingType()) if errs != nil { @@ -1980,7 +1527,7 @@ func setHostSwitchProfileIDsInSchema(hspIDs []model.HostSwitchProfileTypeIdEntry return hostSwitchProfileIDs } -func resourceNsxtTransportNodeUpdate(d *schema.ResourceData, m interface{}) error { +func resourceNsxtEdgeTransportNodeUpdate(d *schema.ResourceData, m interface{}) error { connector := getPolicyConnector(m) id := d.Id() if id == "" { @@ -2001,10 +1548,10 @@ func resourceNsxtTransportNodeUpdate(d *schema.ResourceData, m interface{}) erro return handleUpdateError("TransportNode", id, err) } - return resourceNsxtTransportNodeRead(d, m) + return resourceNsxtEdgeTransportNodeRead(d, m) } -func resourceNsxtTransportNodeDelete(d *schema.ResourceData, m interface{}) error { +func resourceNsxtEdgeTransportNodeDelete(d *schema.ResourceData, m interface{}) error { connector := getPolicyConnector(m) id := d.Id() diff --git a/nsxt/resource_nsxt_policy_host_transport_node.go b/nsxt/resource_nsxt_policy_host_transport_node.go index a4be5e0bf..7676e73db 100644 --- a/nsxt/resource_nsxt_policy_host_transport_node.go +++ b/nsxt/resource_nsxt_policy_host_transport_node.go @@ -9,10 +9,10 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/vmware/vsphere-automation-sdk-go/runtime/protocol/client" + "github.com/vmware/vsphere-automation-sdk-go/services/nsxt-mp/nsx/model" "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra" "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/infra/sites/enforcement_points" model2 "github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model" - "golang.org/x/exp/maps" ) func resourceNsxtPolicyHostTransportNode() *schema.Resource { @@ -45,7 +45,7 @@ func resourceNsxtPolicyHostTransportNode() *schema.Resource { Description: "ID of the enforcement point this Host Transport Node belongs to", Optional: true, ForceNew: true, - Computed: true, + Default: "default", }, "discovered_node_id": { Type: schema.TypeString, @@ -55,40 +55,62 @@ func resourceNsxtPolicyHostTransportNode() *schema.Resource { }, "node_deployment_info": getFabricHostNodeSchema(), // host_switch_spec - "standard_host_switch": getStandardHostSwitchSchema(), - "preconfigured_host_switch": getPreconfiguredHostSwitchSchema(), + "standard_host_switch": getStandardHostSwitchSchema(nodeTypeHost), }, } } func getFabricHostNodeSchema() *schema.Schema { - elemSchema := map[string]*schema.Schema{ - "fqdn": { - Type: schema.TypeString, - Computed: true, - Description: "Fully qualified domain name of the fabric node", - }, - "ip_addresses": { - Type: schema.TypeList, - Optional: true, - Computed: true, - Description: "IP Addresses of the Node, version 4 or 6", - Elem: &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateSingleIP(), - }, - }, - } - maps.Copy(elemSchema, getSharedHostNodeSchemaAttrs()) - s := schema.Schema{ + return &schema.Schema{ Type: schema.TypeList, MaxItems: 1, Optional: true, Elem: &schema.Resource{ - Schema: elemSchema, + Schema: map[string]*schema.Schema{ + "fqdn": { + Type: schema.TypeString, + Computed: true, + Description: "Fully qualified domain name of the fabric node", + }, + "ip_addresses": { + Type: schema.TypeList, + Optional: true, + Computed: true, + Description: "IP Addresses of the Node, version 4 or 6", + Elem: &schema.Schema{ + Type: schema.TypeString, + ValidateFunc: validateSingleIP(), + }, + }, + "host_credential": { + Type: schema.TypeList, + MaxItems: 1, + Description: "Host login credentials", + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "password": { + Type: schema.TypeString, + Sensitive: true, + Required: true, + Description: "The authentication password of the host node", + }, + "thumbprint": { + Type: schema.TypeString, + Optional: true, + Description: "ESXi thumbprint or SSH key fingerprint of the host node", + }, + "username": { + Type: schema.TypeString, + Required: true, + Description: "The username of the account on the host node", + }, + }, + }, + }, + }, }, } - return &s } func resourceNsxtPolicyHostTransportNodeRead(d *schema.ResourceData, m interface{}) error { @@ -118,7 +140,7 @@ func resourceNsxtPolicyHostTransportNodeRead(d *schema.ResourceData, m interface d.Set("path", obj.Path) d.Set("revision", obj.Revision) - err = setHostSwitchSpecInSchema(d, obj.HostSwitchSpec) + err = setHostSwitchSpecInSchema(d, obj.HostSwitchSpec, nodeTypeHost) if err != nil { return err } @@ -128,10 +150,6 @@ func resourceNsxtPolicyHostTransportNodeRead(d *schema.ResourceData, m interface elem["fqdn"] = fabricHostNode.Fqdn elem["ip_addresses"] = fabricHostNode.IpAddresses - elem["os_type"] = fabricHostNode.OsType - elem["os_version"] = fabricHostNode.OsVersion - elem["windows_install_location"] = fabricHostNode.WindowsInstallLocation - d.Set("node_deployment_info", []map[string]interface{}{elem}) return nil @@ -179,16 +197,12 @@ func getFabricHostNodeFromSchema(d *schema.ResourceData) *model2.FabricHostNode Username: &username, } } - osType := nodeInfo["os_type"].(string) - osVersion := nodeInfo["os_version"].(string) - windowsInstallLocation := nodeInfo["windows_install_location"].(string) + osType := model.HostNode_OS_TYPE_ESXI fabricHostNode := model2.FabricHostNode{ - IpAddresses: ipAddresses, - HostCredential: hostCredential, - OsType: &osType, - OsVersion: &osVersion, - WindowsInstallLocation: &windowsInstallLocation, + IpAddresses: ipAddresses, + HostCredential: hostCredential, + OsType: &osType, } return &fabricHostNode } @@ -204,7 +218,7 @@ func policyHostTransportNodePatch(siteID, epID, htnID string, d *schema.Resource tags := getPolicyTagsFromSchema(d) discoveredNodeID := d.Get("discovered_node_id").(string) nodeDeploymentInfo := getFabricHostNodeFromSchema(d) - hostSwitchSpec, err := getHostSwitchSpecFromSchema(d) + hostSwitchSpec, err := getHostSwitchSpecFromSchema(d, nodeTypeHost) revision := int64(d.Get("revision").(int)) if err != nil { return fmt.Errorf("failed to create hostSwitchSpec of HostTransportNode: %v", err) diff --git a/nsxt/resource_nsxt_policy_host_transport_node_profile.go b/nsxt/resource_nsxt_policy_host_transport_node_profile.go index 7d2a73320..237d2094b 100644 --- a/nsxt/resource_nsxt_policy_host_transport_node_profile.go +++ b/nsxt/resource_nsxt_policy_host_transport_node_profile.go @@ -29,8 +29,7 @@ func resourceNsxtPolicyHostTransportNodeProfile() *schema.Resource { "revision": getRevisionSchema(), "tag": getTagsSchema(), // host_switch_spec - "standard_host_switch": getStandardHostSwitchSchema(), - "preconfigured_host_switch": getPreconfiguredHostSwitchSchema(), + "standard_host_switch": getStandardHostSwitchSchema(nodeTypeHost), "ignore_overridden_hosts": { Type: schema.TypeBool, Default: false, @@ -70,7 +69,7 @@ func resourceNsxtPolicyHostTransportNodeProfileCreate(d *schema.ResourceData, m tags := getPolicyTagsFromSchema(d) ignoreOverridenHosts := d.Get("ignore_overridden_hosts").(bool) - hostSwitchSpec, err := getHostSwitchSpecFromSchema(d) + hostSwitchSpec, err := getHostSwitchSpecFromSchema(d, nodeTypeHost) if err != nil { return err } @@ -114,7 +113,7 @@ func resourceNsxtPolicyHostTransportNodeProfileRead(d *schema.ResourceData, m in d.Set("path", obj.Path) d.Set("revision", obj.Revision) - err = setHostSwitchSpecInSchema(d, obj.HostSwitchSpec) + err = setHostSwitchSpecInSchema(d, obj.HostSwitchSpec, nodeTypeHost) if err != nil { return err } @@ -138,7 +137,7 @@ func resourceNsxtPolicyHostTransportNodeProfileUpdate(d *schema.ResourceData, m tags := getPolicyTagsFromSchema(d) ignoreOverridenHosts := d.Get("ignore_overridden_hosts").(bool) - hostSwitchSpec, err := getHostSwitchSpecFromSchema(d) + hostSwitchSpec, err := getHostSwitchSpecFromSchema(d, nodeTypeHost) if err != nil { return err } diff --git a/website/docs/d/compute_manager.html.markdown b/website/docs/d/compute_manager.html.markdown index b142955c7..1ccee4abc 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 resource. -* `server` - IP address or hostname of the resource. \ No newline at end of file +* `server` - IP address or hostname of the resource. diff --git a/website/docs/d/transport_node_realization.html.markdown b/website/docs/d/transport_node_realization.html.markdown index b712e461e..5d9fb60b2 100644 --- a/website/docs/d/transport_node_realization.html.markdown +++ b/website/docs/d/transport_node_realization.html.markdown @@ -16,44 +16,39 @@ resource "nsxt_transport_node" "test" { description = "Terraform-deployed edge node" display_name = "tf_edge_node" standard_host_switch { - host_switch_mode = "STANDARD" - host_switch_type = "NVDS" ip_assignment { static_ip_pool = data.nsxt_ip_pool.ipp1.id } transport_zone_endpoint { - transport_zone = data.nsxt_transport_zone.tz1.id - transport_zone_profile = ["52035bb3-ab02-4a08-9884-18631312e50a"] + transport_zone = data.nsxt_transport_zone.tz1.id + transport_zone_profiles = ["52035bb3-ab02-4a08-9884-18631312e50a"] } host_switch_profile = [nsxt_policy_uplink_host_switch_profile.hsw_profile1.id] - is_migrate_pnics = false pnic { device_name = "fp-eth0" uplink_name = "uplink1" } } - edge_node { - deployment_config { - form_factor = "SMALL" - node_user_settings { - cli_password = "some_cli_password" - root_password = "some_other_password" - } - vm_deployment_config { - management_network_id = data.vsphere_network.network1.id - data_network_ids = [data.vsphere_network.network1.id] - compute_id = data.vsphere_compute_cluster.compute_cluster1.id - storage_id = data.vsphere_datastore.datastore1.id - vc_id = nsxt_compute_manager.vc1.id - host_id = data.vsphere_host.host1.id - } + deployment_config { + form_factor = "SMALL" + node_user_settings { + cli_password = "some_cli_password" + root_password = "some_other_password" } - node_settings { - hostname = "tf_edge_node" - allow_ssh_root_login = true - enable_ssh = true + vm_deployment_config { + management_network_id = data.vsphere_network.network1.id + data_network_ids = [data.vsphere_network.network1.id] + compute_id = data.vsphere_compute_cluster.compute_cluster1.id + storage_id = data.vsphere_datastore.datastore1.id + vc_id = nsxt_compute_manager.vc1.id + host_id = data.vsphere_host.host1.id } } + node_settings { + hostname = "tf_edge_node" + allow_ssh_root_login = true + enable_ssh = true + } } data "nsxt_transport_node_realization" "test" { diff --git a/website/docs/r/edge_transport_node.html.markdown b/website/docs/r/edge_transport_node.html.markdown new file mode 100644 index 000000000..bc4049375 --- /dev/null +++ b/website/docs/r/edge_transport_node.html.markdown @@ -0,0 +1,155 @@ +--- +subcategory: "Beta" +layout: "nsxt" +page_title: "NSXT: nsxt_edge_transport_node" +description: A resource to configure an Edge Transport Node. +--- + +# nsxt_edge_transport_node + +This resource provides a method for the management of an Edge Transport Node. +This resource is supported with NSX 4.1.0 onwards. + +## Example Usage + +```hcl +resource "nsxt_edge_transport_node" "test" { + description = "Terraform-deployed edge node" + display_name = "tf_edge_node" + standard_host_switch { + ip_assignment { + assigned_by_dhcp = true + } + transport_zone_endpoint { + transport_zone = data.nsxt_transport_zone.tz1.id + transport_zone_profiles = ["52035bb3-ab02-4a08-9884-18631312e50a"] + } + host_switch_profile = [nsxt_policy_uplink_host_switch_profile.hsw_profile1.id] + pnic { + device_name = "fp-eth0" + uplink_name = "uplink1" + } + } + deployment_config { + form_factor = "SMALL" + node_user_settings { + cli_password = "some_cli_password" + root_password = "some_other_password" + } + vm_deployment_config { + management_network_id = data.vsphere_network.network1.id + data_network_ids = [data.vsphere_network.network1.id] + compute_id = data.vsphere_compute_cluster.compute_cluster1.id + storage_id = data.vsphere_datastore.datastore1.id + vc_id = nsxt_compute_manager.vc1.id + host_id = data.vsphere_host.host1.id + } + } + node_settings { + hostname = "tf_edge_node" + allow_ssh_root_login = true + enable_ssh = true + } +} +``` + +**NOTE:** `data.vsphere_network`, `data.vsphere_compute_cluster`, `data.vsphere_datastore`, `data.vsphere_host` are +obtained using [hashicorp/vsphere](https://registry.terraform.io/providers/hashicorp/vsphere/) provider. + +## Argument Reference + +The following arguments are supported: + +* `display_name` - (Required) Display name of the resource. +* `description` - (Optional) Description of the resource. +* `tag` - (Optional) A list of scope + tag pairs to associate with this resource. +* `failure_domain` - (Optional) Id of the failure domain. +* `standard_host_switch` - (Required) Standard host switch specification. + * `host_switch_id` - (Optional) The host switch id. This ID will be used to reference a 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. + * `static_ip` - (Optional) IP assignment specification for Static IP List. + * `ip_addresses` - (Required) List of IPs for transport node host switch virtual tunnel endpoints. + * `subnet_mask` - (Required) Subnet mask. + * `default_gateway` - (Required) Gateway IP. + * `static_ip_pool` - (Optional) IP assignment specification for Static IP Pool. Pool ID is expected here (if `nsxt_policy_ip_pool` object is referenced here, please use `realized_id` attribute) + * `pnic` - (Optional) Physical NICs connected to the host switch. + * `device_name` - (Required) Device name or key. + * `uplink_name` - (Required) Uplink name for this Pnic. + * `transport_zone_endpoint` - (Optional) Transport zone endpoints + * `transport_zone` - (Required) Unique ID identifying the transport zone for this endpoint. + * `transport_zone_profiles` - (Optional) Identifiers of the transport zone profiles associated with this transport zone endpoint on this transport node. +* `external_id` - (Optional) ID of the Node. +* `fqdn` - (Optional) Fully qualified domain name of the fabric node. +* `id` - (Optional) Unique identifier of this resource. +* `ip_addresses` - (Optional) IP Addresses of the Node, version 4 or 6. +* `deployment_config` - (Optional) Config for automatic deployment of edge node virtual machine. + * `form_factor` - (Optional) Accepted values - 'SMALL', 'MEDIUM', 'LARGE', 'XLARGE'. The default value is 'MEDIUM'. + * `node_user_settings` - (Required) Node user settings. + * `audit_password` - (Optional) Node audit user password. + * `audit_username` - (Optional) CLI "audit" username. + * `cli_password` - (Required) Node cli password. + * `cli_username` - (Optional) CLI "admin" username. Defaults to "admin". + * `root_password` - (Required) Node root user password. + * `vm_deployment_config` - (Required) The vSphere deployment configuration determines where to deploy the edge node. + * `compute_folder_id` - (Optional) Cluster identifier or resourcepool identifier for specified vcenter server. + * `data_network_ids` - (Required) List of portgroups, logical switch identifiers or segment paths for datapath connectivity. + * `default_gateway_address` - (Optional) Default gateway for the node. + * `host_id` - (Optional) Host identifier in the specified vcenter server. + * `management_network_id` - (Required) Portgroup, logical switch identifier or segment path for management network connectivity. + * `management_port_subnet` - (Optional) Port subnets for management port. IPv4, IPv6 and Dual Stack Address is supported. + * `ip_addresses` - (Required) List of IP addresses. + * `prefix_length` - (Required) Subnet Prefix Length. + * `reservation_info` - (Optional) Resource reservation settings. + * `cpu_reservation_in_mhz` - (Optional) CPU reservation in MHz. + * `cpu_reservation_in_shares` - (Optional) CPU reservation in shares. Accepted values - 'EXTRA_HIGH_PRIORITY', 'HIGH_PRIORITY', 'NORMAL_PRIORITY', 'LOW_PRIORITY'. The default value is 'HIGH_PRIORITY'. + * `memory_reservation_percentage` - (Optional) Memory reservation percentage. + * `storage_id` - (Required) Storage/datastore identifier in the specified vcenter server + * `vc_id` - (Required) Vsphere compute identifier for identifying the vcenter server. +* `node_settings` - (Required) Current configuration on edge node. + * `advanced_configuration` - (Optional) Advanced configuration. + * `key` - (Required) + * `value` - (Required) + * `allow_ssh_root_login` - (Optional) Allow root SSH logins. Defaults to false. + * `dns_servers` - (Optional) List of DNS servers. + * `enable_ssh` - (Optional) Enable SSH. Defaults to false. + * `enable_upt_mode` - (Optional) Enable Uniform Passthrough mode. Defaults to false. + * `hostname` - (Required) Host name or FQDN for edge node. + * `ntp_servers` - (Optional) List of NTP servers. + * `search_domains` - (Optional) List of Search domain names. + * `syslog_server` - (Optional) List of Syslog servers. + * `log_level` - (Optional) Log level to be redirected. Accepted values - 'EMERGENCY', 'ALERT', 'CRITICAL', 'ERROR', 'WARNING', 'NOTICE', 'INFO' or 'DEBUG'. The default value is 'INFO'. + * `name` - (Optional) Display name of the syslog server. + * `port` - (Optional) Syslog server port. Defaults to 514. + * `protocol` - (Optional) Syslog protocol. Accepted values - 'TCP', 'UDP', 'TLS', 'LI', 'LI_TLS'. The default value is 'UDP'. + * `server` - (Required) Server IP or fqdn. +* `remote_tunnel_endpoint` - (Optional) Configuration for a remote tunnel endpoint. + * `host_switch_name` - (Required) The host switch name to be used for the remote tunnel endpoint. + * `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. + * `static_ip` - (Optional) IP assignment specification for Static IP List. + * `ip_addresses` - (Required) List of IPs for transport node host switch virtual tunnel endpoints. + * `subnet_mask` - (Required) Subnet mask. + * `default_gateway` - (Required) Gateway IP. + * `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. + +## Attributes Reference + +In addition to arguments listed above, the following attributes are exported: + +* `id` - ID of the resource. +* `revision` - Indicates current revision number of the object as seen by NSX-T API server. This attribute can be useful for debugging. + +## Importing + +An existing Edge Transport Node can be [imported][docs-import] into this resource, via the following command: + +[docs-import]: https://www.terraform.io/cli/import + +``` +terraform import nsxt_edge_transport_node.test UUID +``` +The above command imports Edge Transport Node named `test` with the NSX Transport Node ID `UUID`. diff --git a/website/docs/r/policy_host_transport_node.html.markdown b/website/docs/r/policy_host_transport_node.html.markdown index 7fdfb4d63..6adf8aac9 100644 --- a/website/docs/r/policy_host_transport_node.html.markdown +++ b/website/docs/r/policy_host_transport_node.html.markdown @@ -14,17 +14,12 @@ This resource is supported with NSX 4.1.0 onwards. ```hcl resource "nsxt_policy_host_transport_node" "test" { - description = "Terraform-deployed host transport node" - display_name = "tf_host_transport_node" - site_path = "/infra/sites/default" - enforcement_point = "default" + description = "Terraform-deployed host transport node" + display_name = "tf_host_transport_node" node_deployment_info { ip_addresses = ["10.168.186.150"] - os_type = "ESXI" - os_version = "7.0.3" - host_credential { username = "user1" password = "password1" @@ -33,8 +28,6 @@ resource "nsxt_policy_host_transport_node" "test" { } standard_host_switch { - host_switch_mode = "STANDARD" - host_switch_type = "NVDS" host_switch_profile = [data.nsxt_policy_uplink_host_switch_profile.hsw_profile1.path] ip_assignment { @@ -65,8 +58,8 @@ The following arguments are supported: * `display_name` - (Required) Display name of the resource. * `description` - (Optional) Description of the resource. * `tag` - (Optional) A list of scope + tag pairs to associate with this resource. -* `site_path` - (Optional) The path of the site which the Host Transport Node belongs to. `path` field of the existing `nsxt_policy_site` can be used here. -* `enforcement_point` - (Optional) The ID of enforcement point under given `site_path` to manage the Host Transport Node. +* `site_path` - (Optional) The path of the site which the Host Transport Node belongs to. `path` field of the existing `nsxt_policy_site` can be used here. Defaults to default site path. +* `enforcement_point` - (Optional) The ID of enforcement point under given `site_path` to manage the Host Transport Node. Defaults to default enforcement point. * `discovered_node_id` - (Optional) Discovered node id to create Host Transport Node. Specify discovered node id to create Host Transport Node for Discovered Node. This field is required during Host Transport Node create from vCenter server managing the ESXi type HostNode. * `node_deployment_info` - (Optional) * `fqdn` - (Optional) Fully qualified domain name of the fabric node. @@ -75,35 +68,21 @@ The following arguments are supported: * `password` - (Required) The authentication password of the host node. * `thumbprint` - (Optional) ESXi thumbprint or SSH key fingerprint of the host node. * `username` - (Required) The username of the account on the host node. - * `os_type` - (Required) Hypervisor OS type. Accepted values - 'ESXI', 'RHELSERVER', 'WINDOWSSERVER', 'RHELCONTAINER', 'UBUNTUSERVER', 'HYPERV', 'CENTOSSERVER', 'CENTOSCONTAINER', 'SLESSERVER' or 'OELSERVER'. - * `os_version` - (Optional) Hypervisor OS version. - * `windows_install_location` - (Optional) Install location of Windows Server on baremetal being managed by NSX. Defaults to 'C:\Program Files\VMware\NSX\'. -* `standard_host_switch` - (Optional) Standard host switch specification. - * `cpu_config` - (Optional) Enhanced Networking Stack enabled HostSwitch CPU configuration. - * `num_lcores` - (Required) Number of Logical cpu cores (Lcores) to be placed on a specified NUMA node. - * `numa_node_index` - (Required) Unique index of the Non Uniform Memory Access (NUMA) node. +* `standard_host_switch` - (Required) Standard host switch specification. * `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` - (Optional) Policy path 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. * `static_ip` - (Optional) IP assignment specification for Static IP List. * `ip_addresses` - (Required) List of IPs for transport node host switch virtual tunnel endpoints. * `subnet_mask` - (Required) Subnet mask. * `default_gateway` - (Required) Gateway IP. - * `static_ip_mac` - (Optional) IP and MAC assignment specification for Static IP List. - * `default_gateway` - (Required) Gateway IP. - * `subnet_mask` - (Required) Subnet mask. - * `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` - (Optional) Policy path of Static IP Pool used for IP assignment specification. + * `static_ip_pool` - (Optional) Policy path of Static IP Pool used for IP assignment specification. * `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` - (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. @@ -114,12 +93,6 @@ The following arguments are supported: * `ip_addresses` - (Required) List of IPs for transport node host switch virtual tunnel endpoints. * `subnet_mask` - (Required) Subnet mask. * `default_gateway` - (Required) Gateway IP. - * `static_ip_mac` - (Optional) IP and MAC assignment specification for Static IP List. - * `default_gateway` - (Required) Gateway IP. - * `subnet_mask` - (Required) Subnet mask. - * `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` - (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. @@ -128,7 +101,7 @@ The following arguments are supported: * `name` - (Required) Name of the transport node profile config option. * `transport_zone_endpoint` - (Optional) Transport zone endpoints * `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. + * `transport_zone_profiles` - (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. @@ -136,14 +109,6 @@ The following arguments are supported: * `vmk_install_migration` - (Optional) The vmknic and logical switch mappings. * `destination_network` - (Required) The network id to which the ESX vmk interface will be migrated. * `device_name` - (Required) ESX vmk interface name. -* `preconfigured_host_switch` - (Optional) Preconfigured host switch. - * `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` - (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. - -**NOTE:** Resource should contain either `standard_host_switch` or `preconfigured_host_switch` ## Attributes Reference 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 592c36639..97d7da912 100644 --- a/website/docs/r/policy_host_transport_node_profile.html.markdown +++ b/website/docs/r/policy_host_transport_node_profile.html.markdown @@ -16,8 +16,6 @@ resource "nsxt_policy_host_transport_node_profile" "test" { display_name = "test_policy_host_tnp" standard_host_switch { - host_switch_mode = "STANDARD" - host_switch_type = "NVDS" ip_assignment { assigned_by_dhcp = true } @@ -42,32 +40,21 @@ The following arguments are supported: * `description` - (Optional) Description of the resource. * `tag` - (Optional) A list of scope + tag pairs to associate with this resource. * `ignore_overridden_hosts` - (Optional) Determines if cluster-level configuration should be applied on overridden hosts -* `standard_host_switch` - (Optional) Standard host switch specification. - * `cpu_config` - (Optional) Enhanced Networking Stack enabled HostSwitch CPU configuration. - * `num_lcores` - (Required) Number of Logical cpu cores (Lcores) to be placed on a specified NUMA node. - * `numa_node_index` - (Required) Unique index of the Non Uniform Memory Access (NUMA) node. +* `standard_host_switch` - (Required) Standard host switch specification. * `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` - (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. * `static_ip` - (Optional) IP assignment specification for Static IP List. * `ip_addresses` - (Required) List of IPs for transport node host switch virtual tunnel endpoints. * `subnet_mask` - (Required) Subnet mask. * `default_gateway` - (Required) Gateway IP. - * `static_ip_mac` - (Optional) IP and MAC assignment specification for Static IP List. - * `default_gateway` - (Required) Gateway IP. - * `subnet_mask` - (Required) Subnet mask. - * `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` - (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` - (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. @@ -78,12 +65,6 @@ The following arguments are supported: * `ip_addresses` - (Required) List of IPs for transport node host switch virtual tunnel endpoints. * `subnet_mask` - (Required) Subnet mask. * `default_gateway` - (Required) Gateway IP. - * `static_ip_mac` - (Optional) IP and MAC assignment specification for Static IP List. - * `default_gateway` - (Required) Gateway IP. - * `subnet_mask` - (Required) Subnet mask. - * `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` - (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. @@ -92,7 +73,7 @@ The following arguments are supported: * `name` - (Required) Name of the transport node profile config option. * `transport_zone_endpoint` - (Optional) Transport zone endpoints * `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. + * `transport_zone_profiles` - (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. @@ -100,12 +81,6 @@ The following arguments are supported: * `vmk_install_migration` - (Optional) The vmknic and logical switch mappings. * `destination_network` - (Required) The network id to which the ESX vmk interface will be migrated. * `device_name` - (Required) ESX vmk interface name. -* `preconfigured_host_switch` - (Optional) Preconfigured host switch. - * `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` - (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 deleted file mode 100644 index 17f89c164..000000000 --- a/website/docs/r/transport_node.html.markdown +++ /dev/null @@ -1,274 +0,0 @@ ---- -subcategory: "Beta" -layout: "nsxt" -page_title: "NSXT: nsxt_transport_node" -description: A resource to configure a Transport Node. ---- - -# nsxt_transport_node - -This resource provides a method for the management of a Transport Node. -This resource is supported with NSX 4.1.0 onwards. - -## Example Usage - -```hcl -resource "nsxt_transport_node" "test" { - description = "Terraform-deployed edge node" - display_name = "tf_edge_node" - standard_host_switch { - host_switch_mode = "STANDARD" - host_switch_type = "NVDS" - ip_assignment { - assigned_by_dhcp = true - } - transport_zone_endpoint { - transport_zone = data.nsxt_transport_zone.tz1.id - transport_zone_profile = ["52035bb3-ab02-4a08-9884-18631312e50a"] - } - host_switch_profile = [nsxt_policy_uplink_host_switch_profile.hsw_profile1.id] - is_migrate_pnics = false - pnic { - device_name = "fp-eth0" - uplink_name = "uplink1" - } - } - edge_node { - deployment_config { - form_factor = "SMALL" - node_user_settings { - cli_password = "some_cli_password" - root_password = "some_other_password" - } - vm_deployment_config { - management_network_id = data.vsphere_network.network1.id - data_network_ids = [data.vsphere_network.network1.id] - compute_id = data.vsphere_compute_cluster.compute_cluster1.id - storage_id = data.vsphere_datastore.datastore1.id - vc_id = nsxt_compute_manager.vc1.id - host_id = data.vsphere_host.host1.id - } - } - node_settings { - hostname = "tf_edge_node" - allow_ssh_root_login = true - enable_ssh = true - } - } -} -``` - -**NOTE:** `data.vsphere_network`, `data.vsphere_compute_cluster`, `data.vsphere_datastore`, `data.vsphere_host` are -obtained using [hashicorp/vsphere](https://registry.terraform.io/providers/hashicorp/vsphere/) provider. - -## Argument Reference - -The following arguments are supported: - -* `display_name` - (Required) Display name of the resource. -* `description` - (Optional) Description of the resource. -* `tag` - (Optional) A list of scope + tag pairs to associate with this resource. -* `failure_domain` - (Optional) Id of the failure domain. -* `standard_host_switch` - (Optional) Standard host switch specification. - * `cpu_config` - (Optional) Enhanced Networking Stack enabled HostSwitch CPU configuration. - * `num_lcores` - (Required) Number of Logical cpu cores (Lcores) to be placed on a specified NUMA node. - * `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` - (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. - * `static_ip` - (Optional) IP assignment specification for Static IP List. - * `ip_addresses` - (Required) List of IPs for transport node host switch virtual tunnel endpoints. - * `subnet_mask` - (Required) Subnet mask. - * `default_gateway` - (Required) Gateway IP. - * `static_ip_mac` - (Optional) IP and MAC assignment specification for Static IP List. - * `default_gateway` - (Required) Gateway IP. - * `subnet_mask` - (Required) Subnet mask. - * `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` - (Optional) IP assignment specification for Static IP Pool. Pool ID is expected here (if `nsxt_policy_ip_pool` object is referenced here, please use `realized_id` attribute) - * `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` - (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` - (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. - * `static_ip` - (Optional) IP assignment specification for Static IP List. - * `ip_addresses` - (Required) List of IPs for transport node host switch virtual tunnel endpoints. - * `subnet_mask` - (Required) Subnet mask. - * `default_gateway` - (Required) Gateway IP. - * `static_ip_mac` - (Optional) IP and MAC assignment specification for Static IP List. - * `default_gateway` - (Required) Gateway IP. - * `subnet_mask` - (Required) Subnet mask. - * `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` - (Optional) IP assignment specification for Static IP Pool. Pool ID is expected here (if `nsxt_policy_ip_pool` object is referenced here, please use `realized_id` attribute) - * `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` - (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. - * `vds_uplink_name` - (Optional) Uplink name of VMware vSphere Distributed Switch (VDS). - * `vmk_install_migration` - (Optional) The vmknic and logical switch mappings. - * `destination_network` - (Required) The network id to which the ESX vmk interface will be migrated. - * `device_name` - (Required) ESX vmk interface name. -* `preconfigured_host_switch` - (Optional) Preconfigured host switch. - * `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` - (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. - * `id` - (Optional) Unique identifier of this resource. - * `ip_addresses` - (Optional) IP Addresses of the Node, version 4 or 6. -* `host_node` - (Optional) - * `external_id` - (Optional) ID of the Node. - * `fqdn` - (Optional) Fully qualified domain name of the fabric node. - * `id` - (Optional) Unique identifier of this resource. - * `ip_addresses` - (Optional) IP Addresses of the Node, version 4 or 6. - * `host_credential` - (Optional) Host login credentials. - * `password` - (Required) The authentication password of the host node. - * `thumbprint` - (Optional) ESXi thumbprint or SSH key fingerprint of the host node. - * `username` - (Required) The username of the account on the host node. - * `os_type` - (Required) Hypervisor OS type. Accepted values - 'ESXI', 'RHELSERVER', 'WINDOWSSERVER', 'RHELCONTAINER', 'UBUNTUSERVER', 'HYPERV', 'CENTOSSERVER', 'CENTOSCONTAINER', 'SLESSERVER' or 'OELSERVER'. - * `os_version` - (Optional) Hypervisor OS version. - * `windows_install_location` - (Optional) Install location of Windows Server on baremetal being managed by NSX. Defaults to 'C:\Program Files\VMware\NSX\'. -* `edge_node` - (Optional) - * `deployment_config` - (Optional) Config for automatic deployment of edge node virtual machine. - * `form_factor` - (Optional) Accepted values - 'SMALL', 'MEDIUM', 'LARGE', 'XLARGE'. The default value is 'MEDIUM'. - * `node_user_settings` - (Required) Node user settings. - * `audit_password` - (Optional) Node audit user password. - * `audit_username` - (Optional) CLI "audit" username. - * `cli_password` - (Required) Node cli password. - * `cli_username` - (Optional) CLI "admin" username. Defaults to "admin". - * `root_password` - (Required) Node root user password. - * `vm_deployment_config` - (Required) The vSphere deployment configuration determines where to deploy the edge node. - * `compute_folder_id` - (Optional) Cluster identifier or resourcepool identifier for specified vcenter server. - * `data_network_ids` - (Required) List of portgroups, logical switch identifiers or segment paths for datapath connectivity. - * `default_gateway_address` - (Optional) Default gateway for the node. - * `host_id` - (Optional) Host identifier in the specified vcenter server. - * `management_network_id` - (Required) Portgroup, logical switch identifier or segment path for management network connectivity. - * `management_port_subnet` - (Optional) Port subnets for management port. IPv4, IPv6 and Dual Stack Address is supported. - * `ip_addresses` - (Required) List of IP addresses. - * `prefix_length` - (Required) Subnet Prefix Length. - * `reservation_info` - (Optional) Resource reservation settings. - * `cpu_reservation_in_mhz` - (Optional) CPU reservation in MHz. - * `cpu_reservation_in_shares` - (Optional) CPU reservation in shares. Accepted values - 'EXTRA_HIGH_PRIORITY', 'HIGH_PRIORITY', 'NORMAL_PRIORITY', 'LOW_PRIORITY'. The default value is 'HIGH_PRIORITY'. - * `memory_reservation_percentage` - (Optional) Memory reservation percentage. - * `storage_id` - (Required) Storage/datastore identifier in the specified vcenter server - * `vc_id` - (Required) Vsphere compute identifier for identifying the vcenter server. - * `node_settings` - (Required) Current configuration on edge node. - * `advanced_configuration` - (Optional) Advanced configuration. - * `key` - (Required) - * `value` - (Required) - * `allow_ssh_root_login` - (Optional) Allow root SSH logins. Defaults to false. - * `dns_servers` - (Optional) List of DNS servers. - * `enable_ssh` - (Optional) Enable SSH. Defaults to false. - * `enable_upt_mode` - (Optional) Enable Uniform Passthrough mode. Defaults to false. - * `hostname` - (Required) Host name or FQDN for edge node. - * `ntp_servers` - (Optional) List of NTP servers. - * `search_domains` - (Optional) List of Search domain names. - * `syslog_server` - (Optional) List of Syslog servers. - * `log_level` - (Optional) Log level to be redirected. Accepted values - 'EMERGENCY', 'ALERT', 'CRITICAL', 'ERROR', 'WARNING', 'NOTICE', 'INFO' or 'DEBUG'. The default value is 'INFO'. - * `name` - (Optional) Display name of the syslog server. - * `port` - (Optional) Syslog server port. Defaults to 514. - * `protocol` - (Optional) Syslog protocol. Accepted values - 'TCP', 'UDP', 'TLS', 'LI', 'LI_TLS'. The default value is 'UDP'. - * `server` - (Required) Server IP or fqdn. -* `public_cloud_gateway_node` - (Optional) - * `deployment_config` - (Optional) Config for automatic deployment of edge node virtual machine. - * `form_factor` - (Optional) Accepted values - 'SMALL', 'MEDIUM', 'LARGE', 'XLARGE'. The default value is 'MEDIUM'. - * `node_user_settings` - (Required) Node user settings. - * `audit_password` - (Optional) Node audit user password. - * `audit_username` - (Optional) CLI "audit" username. - * `cli_password` - (Required) Node cli password. - * `cli_username` - (Optional) CLI "admin" username. Defaults to "admin". - * `root_password` - (Required) Node root user password. - * `vm_deployment_config` - (Required) The vSphere deployment configuration determines where to deploy the edge node. - * `compute_folder_id` - (Optional) Cluster identifier or resourcepool identifier for specified vcenter server. - * `data_network_ids` - (Required) List of portgroups, logical switch identifiers or segment paths for datapath connectivity. - * `default_gateway_address` - (Optional) Default gateway for the node. - * `host_id` - (Optional) Host identifier in the specified vcenter server. - * `management_network_id` - (Required) Portgroup, logical switch identifier or segment path for management network connectivity. - * `management_port_subnet` - (Optional) Port subnets for management port. IPv4, IPv6 and Dual Stack Address is supported. - * `ip_addresses` - (Required) List of IP addresses. - * `prefix_length` - (Required) Subnet Prefix Length. - * `reservation_info` - (Optional) Resource reservation settings. - * `cpu_reservation_in_mhz` - (Optional) CPU reservation in MHz. - * `cpu_reservation_in_shares` - (Optional) CPU reservation in shares. Accepted values - 'EXTRA_HIGH_PRIORITY', 'HIGH_PRIORITY', 'NORMAL_PRIORITY', 'LOW_PRIORITY'. The default value is 'HIGH_PRIORITY'. - * `memory_reservation_percentage` - (Optional) Memory reservation percentage. - * `storage_id` - (Required) Storage/datastore identifier in the specified vcenter server - * `vc_id` - (Required) Vsphere compute identifier for identifying the vcenter server. - * `node_settings` - (Required) Current configuration on edge node. - * `advanced_configuration` - (Optional) Advanced configuration. - * `key` - (Required) - * `value` - (Required) - * `allow_ssh_root_login` - (Optional) Allow root SSH logins. Defaults to false. - * `dns_servers` - (Optional) List of DNS servers. - * `enable_ssh` - (Optional) Enable SSH. Defaults to false. - * `enable_upt_mode` - (Optional) Enable Uniform Passthrough mode. Defaults to false. - * `hostname` - (Required) Host name or FQDN for edge node. - * `ntp_servers` - (Optional) List of NTP servers. - * `search_domains` - (Optional) List of Search domain names. - * `syslog_server` - (Optional) List of Syslog servers. - * `log_level` - (Optional) Log level to be redirected. Accepted values - 'EMERGENCY', 'ALERT', 'CRITICAL', 'ERROR', 'WARNING', 'NOTICE', 'INFO' or 'DEBUG'. The default value is 'INFO'. - * `name` - (Optional) Display name of the syslog server. - * `port` - (Optional) Syslog server port. Defaults to 514. - * `protocol` - (Optional) Syslog protocol. Accepted values - 'TCP', 'UDP', 'TLS', 'LI', 'LI_TLS'. The default value is 'UDP'. - * `server` - (Required) Server IP or fqdn. -* `remote_tunnel_endpoint` - (Optional) Configuration for a remote tunnel endpoint. - * `host_switch_name` - (Required) The host switch name to be used for the remote tunnel endpoint. - * `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. - * `static_ip` - (Optional) IP assignment specification for Static IP List. - * `ip_addresses` - (Required) List of IPs for transport node host switch virtual tunnel endpoints. - * `subnet_mask` - (Required) Subnet mask. - * `default_gateway` - (Required) Gateway IP. - * `static_ip_mac` - (Optional) IP and MAC assignment specification for Static IP List. - * `default_gateway` - (Required) Gateway IP. - * `subnet_mask` - (Required) Subnet mask. - * `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` - (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. - - - -**NOTE:** Resource should contain either `standard_host_switch` or `preconfigured_host_switch` -**NOTE:** Resource should contain one of: `node`, `edge_node`, `host_node` or `public_cloud_gateway_node` - -## Attributes Reference - -In addition to arguments listed above, the following attributes are exported: - -* `id` - ID of the resource. -* `revision` - Indicates current revision number of the object as seen by NSX-T API server. This attribute can be useful for debugging. - -## Importing - -An existing Transport Node can be [imported][docs-import] into this resource, via the following command: - -[docs-import]: https://www.terraform.io/cli/import - -``` -terraform import nsxt_transport_node.test UUID -``` -The above command imports Transport Node named `test` with the NSX Transport Node ID `UUID`.