Skip to content

Commit

Permalink
Merge pull request #1384 from salv-orlando/disable_mp_client
Browse files Browse the repository at this point in the history
Disable MP Resources from NSX 9.0.0 onwards
  • Loading branch information
salv-orlando authored Oct 2, 2024
2 parents 26d3e47 + 607d90c commit db61285
Show file tree
Hide file tree
Showing 5 changed files with 274 additions and 72 deletions.
31 changes: 30 additions & 1 deletion nsxt/data_source_nsxt_ip_pool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package nsxt

import (
"fmt"
"regexp"
"testing"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
Expand All @@ -18,7 +19,12 @@ func TestAccDataSourceNsxtIPPool_basic(t *testing.T) {
testResourceName := "data.nsxt_ip_pool.test"

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccOnlyLocalManager(t); testAccTestDeprecated(t); testAccPreCheck(t) },
PreCheck: func() {
testAccOnlyLocalManager(t)
testAccTestDeprecated(t)
testAccPreCheck(t)
testAccNSXVersionLessThan(t, "9.0.0")
},
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Expand All @@ -32,6 +38,29 @@ func TestAccDataSourceNsxtIPPool_basic(t *testing.T) {
})
}

func TestAccDataSourceNsxtIPPool_basic_900(t *testing.T) {
ipPoolName := getIPPoolName()
if ipPoolName == "" {
t.Skipf("No NSXT_TEST_IP_POOL set - skipping test")
}

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() {
testAccOnlyLocalManager(t)
testAccTestDeprecated(t)
testAccPreCheck(t)
testAccNSXVersion(t, "9.0.0")
},
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Config: testAccNSXIPPoolReadTemplate(ipPoolName),
ExpectError: regexp.MustCompile("MP data source.*has been removed in NSX"),
},
},
})
}

func testAccNSXIPPoolReadTemplate(name string) string {
return fmt.Sprintf(`
data "nsxt_ip_pool" "test" {
Expand Down
136 changes: 68 additions & 68 deletions nsxt/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,18 +246,18 @@ func Provider() *schema.Provider {
DataSourcesMap: map[string]*schema.Resource{
"nsxt_provider_info": dataSourceNsxtProviderInfo(),
"nsxt_transport_zone": dataSourceNsxtTransportZone(),
"nsxt_switching_profile": dataSourceNsxtSwitchingProfile(),
"nsxt_logical_tier0_router": dataSourceNsxtLogicalTier0Router(),
"nsxt_logical_tier1_router": dataSourceNsxtLogicalTier1Router(),
"nsxt_mac_pool": dataSourceNsxtMacPool(),
"nsxt_ns_group": dataSourceNsxtNsGroup(),
"nsxt_ns_groups": dataSourceNsxtNsGroups(),
"nsxt_ns_service": dataSourceNsxtNsService(),
"nsxt_ns_services": dataSourceNsxtNsServices(),
"nsxt_switching_profile": removedDataSourceWrapper(dataSourceNsxtSwitchingProfile, "nsxt_switching_profile"),
"nsxt_logical_tier0_router": removedDataSourceWrapper(dataSourceNsxtLogicalTier0Router, "nsxt_logical_tier0_router"),
"nsxt_logical_tier1_router": removedDataSourceWrapper(dataSourceNsxtLogicalTier1Router, "nsxt_logical_tier1_router"),
"nsxt_mac_pool": removedDataSourceWrapper(dataSourceNsxtMacPool, "nsxt_mac_pool"),
"nsxt_ns_group": removedDataSourceWrapper(dataSourceNsxtNsGroup, "nsxt_ns_group"),
"nsxt_ns_groups": removedDataSourceWrapper(dataSourceNsxtNsGroups, "nsxt_ns_groups"),
"nsxt_ns_service": removedDataSourceWrapper(dataSourceNsxtNsService, "nsxt_ns_service"),
"nsxt_ns_services": removedDataSourceWrapper(dataSourceNsxtNsServices, "nsxt_ns_services"),
"nsxt_edge_cluster": dataSourceNsxtEdgeCluster(),
"nsxt_certificate": dataSourceNsxtCertificate(),
"nsxt_ip_pool": dataSourceNsxtIPPool(),
"nsxt_firewall_section": dataSourceNsxtFirewallSection(),
"nsxt_ip_pool": removedDataSourceWrapper(dataSourceNsxtIPPool, "nsxt_ip_pool"),
"nsxt_firewall_section": removedDataSourceWrapper(dataSourceNsxtFirewallSection, "nsxt_firewall_section"),
"nsxt_management_cluster": dataSourceNsxtManagementCluster(),
"nsxt_policy_edge_cluster": dataSourceNsxtPolicyEdgeCluster(),
"nsxt_policy_edge_node": dataSourceNsxtPolicyEdgeNode(),
Expand Down Expand Up @@ -331,64 +331,64 @@ func Provider() *schema.Provider {
},

ResourcesMap: map[string]*schema.Resource{
"nsxt_dhcp_relay_profile": resourceNsxtDhcpRelayProfile(),
"nsxt_dhcp_relay_service": resourceNsxtDhcpRelayService(),
"nsxt_dhcp_server_profile": resourceNsxtDhcpServerProfile(),
"nsxt_logical_dhcp_server": resourceNsxtLogicalDhcpServer(),
"nsxt_dhcp_server_ip_pool": resourceNsxtDhcpServerIPPool(),
"nsxt_logical_switch": resourceNsxtLogicalSwitch(),
"nsxt_vlan_logical_switch": resourceNsxtVlanLogicalSwitch(),
"nsxt_logical_dhcp_port": resourceNsxtLogicalDhcpPort(),
"nsxt_logical_port": resourceNsxtLogicalPort(),
"nsxt_logical_tier0_router": resourceNsxtLogicalTier0Router(),
"nsxt_logical_tier1_router": resourceNsxtLogicalTier1Router(),
"nsxt_logical_router_centralized_service_port": resourceNsxtLogicalRouterCentralizedServicePort(),
"nsxt_logical_router_downlink_port": resourceNsxtLogicalRouterDownLinkPort(),
"nsxt_logical_router_link_port_on_tier0": resourceNsxtLogicalRouterLinkPortOnTier0(),
"nsxt_logical_router_link_port_on_tier1": resourceNsxtLogicalRouterLinkPortOnTier1(),
"nsxt_ip_discovery_switching_profile": resourceNsxtIPDiscoverySwitchingProfile(),
"nsxt_mac_management_switching_profile": resourceNsxtMacManagementSwitchingProfile(),
"nsxt_qos_switching_profile": resourceNsxtQosSwitchingProfile(),
"nsxt_spoofguard_switching_profile": resourceNsxtSpoofGuardSwitchingProfile(),
"nsxt_switch_security_switching_profile": resourceNsxtSwitchSecuritySwitchingProfile(),
"nsxt_l4_port_set_ns_service": resourceNsxtL4PortSetNsService(),
"nsxt_algorithm_type_ns_service": resourceNsxtAlgorithmTypeNsService(),
"nsxt_icmp_type_ns_service": resourceNsxtIcmpTypeNsService(),
"nsxt_igmp_type_ns_service": resourceNsxtIgmpTypeNsService(),
"nsxt_ether_type_ns_service": resourceNsxtEtherTypeNsService(),
"nsxt_ip_protocol_ns_service": resourceNsxtIPProtocolNsService(),
"nsxt_ns_service_group": resourceNsxtNsServiceGroup(),
"nsxt_ns_group": resourceNsxtNsGroup(),
"nsxt_firewall_section": resourceNsxtFirewallSection(),
"nsxt_nat_rule": resourceNsxtNatRule(),
"nsxt_ip_block": resourceNsxtIPBlock(),
"nsxt_ip_block_subnet": resourceNsxtIPBlockSubnet(),
"nsxt_ip_pool": resourceNsxtIPPool(),
"nsxt_ip_pool_allocation_ip_address": resourceNsxtIPPoolAllocationIPAddress(),
"nsxt_ip_set": resourceNsxtIPSet(),
"nsxt_static_route": resourceNsxtStaticRoute(),
"nsxt_vm_tags": resourceNsxtVMTags(),
"nsxt_lb_icmp_monitor": resourceNsxtLbIcmpMonitor(),
"nsxt_lb_tcp_monitor": resourceNsxtLbTCPMonitor(),
"nsxt_lb_udp_monitor": resourceNsxtLbUDPMonitor(),
"nsxt_lb_http_monitor": resourceNsxtLbHTTPMonitor(),
"nsxt_lb_https_monitor": resourceNsxtLbHTTPSMonitor(),
"nsxt_lb_passive_monitor": resourceNsxtLbPassiveMonitor(),
"nsxt_lb_pool": resourceNsxtLbPool(),
"nsxt_lb_tcp_virtual_server": resourceNsxtLbTCPVirtualServer(),
"nsxt_lb_udp_virtual_server": resourceNsxtLbUDPVirtualServer(),
"nsxt_lb_http_virtual_server": resourceNsxtLbHTTPVirtualServer(),
"nsxt_lb_http_forwarding_rule": resourceNsxtLbHTTPForwardingRule(),
"nsxt_lb_http_request_rewrite_rule": resourceNsxtLbHTTPRequestRewriteRule(),
"nsxt_lb_http_response_rewrite_rule": resourceNsxtLbHTTPResponseRewriteRule(),
"nsxt_lb_cookie_persistence_profile": resourceNsxtLbCookiePersistenceProfile(),
"nsxt_lb_source_ip_persistence_profile": resourceNsxtLbSourceIPPersistenceProfile(),
"nsxt_lb_client_ssl_profile": resourceNsxtLbClientSslProfile(),
"nsxt_lb_server_ssl_profile": resourceNsxtLbServerSslProfile(),
"nsxt_lb_service": resourceNsxtLbService(),
"nsxt_lb_fast_tcp_application_profile": resourceNsxtLbFastTCPApplicationProfile(),
"nsxt_lb_fast_udp_application_profile": resourceNsxtLbFastUDPApplicationProfile(),
"nsxt_lb_http_application_profile": resourceNsxtLbHTTPApplicationProfile(),
"nsxt_dhcp_relay_profile": removedResourceWrapper(resourceNsxtDhcpRelayProfile, "nsxt_dhcp_relay_profile"),
"nsxt_dhcp_relay_service": removedResourceWrapper(resourceNsxtDhcpRelayService, "nsxt_dhcp_relay_service"),
"nsxt_dhcp_server_profile": removedResourceWrapper(resourceNsxtDhcpServerProfile, "nsxt_dhcp_server_profile"),
"nsxt_logical_dhcp_server": removedResourceWrapper(resourceNsxtLogicalDhcpServer, "nsxt_logical_dhcp_server"),
"nsxt_dhcp_server_ip_pool": removedResourceWrapper(resourceNsxtDhcpServerIPPool, "nsxt_dhcp_server_ip_pool"),
"nsxt_logical_switch": removedResourceWrapper(resourceNsxtLogicalSwitch, "nsxt_logical_switch"),
"nsxt_vlan_logical_switch": removedResourceWrapper(resourceNsxtVlanLogicalSwitch, "nsxt_vlan_logical_switch"),
"nsxt_logical_dhcp_port": removedResourceWrapper(resourceNsxtLogicalDhcpPort, "nsxt_logical_dhcp_port"),
"nsxt_logical_port": removedResourceWrapper(resourceNsxtLogicalPort, "nsxt_logical_port"),
"nsxt_logical_tier0_router": removedResourceWrapper(resourceNsxtLogicalTier0Router, "nsxt_logical_tier0_router"),
"nsxt_logical_tier1_router": removedResourceWrapper(resourceNsxtLogicalTier1Router, "nsxt_logical_tier1_router"),
"nsxt_logical_router_centralized_service_port": removedResourceWrapper(resourceNsxtLogicalRouterCentralizedServicePort, "nsxt_logical_router_centralized_service_port"),
"nsxt_logical_router_downlink_port": removedResourceWrapper(resourceNsxtLogicalRouterDownLinkPort, "nsxt_logical_router_downlink_port"),
"nsxt_logical_router_link_port_on_tier0": removedResourceWrapper(resourceNsxtLogicalRouterLinkPortOnTier0, "nsxt_logical_router_link_port_on_tier0"),
"nsxt_logical_router_link_port_on_tier1": removedResourceWrapper(resourceNsxtLogicalRouterLinkPortOnTier1, "nsxt_logical_router_link_port_on_tier1"),
"nsxt_ip_discovery_switching_profile": removedResourceWrapper(resourceNsxtIPDiscoverySwitchingProfile, "nsxt_ip_discovery_switching_profile"),
"nsxt_mac_management_switching_profile": removedResourceWrapper(resourceNsxtMacManagementSwitchingProfile, "nsxt_mac_management_switching_profile"),
"nsxt_qos_switching_profile": removedResourceWrapper(resourceNsxtQosSwitchingProfile, "nsxt_qos_switching_profile"),
"nsxt_spoofguard_switching_profile": removedResourceWrapper(resourceNsxtSpoofGuardSwitchingProfile, "nsxt_spoofguard_switching_profile"),
"nsxt_switch_security_switching_profile": removedResourceWrapper(resourceNsxtSwitchSecuritySwitchingProfile, "nsxt_switch_security_switching_profile"),
"nsxt_l4_port_set_ns_service": removedResourceWrapper(resourceNsxtL4PortSetNsService, "nsxt_l4_port_set_ns_service"),
"nsxt_algorithm_type_ns_service": removedResourceWrapper(resourceNsxtAlgorithmTypeNsService, "nsxt_algorithm_type_ns_service"),
"nsxt_icmp_type_ns_service": removedResourceWrapper(resourceNsxtIcmpTypeNsService, "nsxt_icmp_type_ns_service"),
"nsxt_igmp_type_ns_service": removedResourceWrapper(resourceNsxtIgmpTypeNsService, "nsxt_igmp_type_ns_service"),
"nsxt_ether_type_ns_service": removedResourceWrapper(resourceNsxtEtherTypeNsService, "nsxt_ether_type_ns_service"),
"nsxt_ip_protocol_ns_service": removedResourceWrapper(resourceNsxtIPProtocolNsService, "nsxt_ip_protocol_ns_service"),
"nsxt_ns_service_group": removedResourceWrapper(resourceNsxtNsServiceGroup, "nsxt_ns_service_group"),
"nsxt_ns_group": removedResourceWrapper(resourceNsxtNsGroup, "nsxt_ns_group"),
"nsxt_firewall_section": removedResourceWrapper(resourceNsxtFirewallSection, "nsxt_firewall_section"),
"nsxt_nat_rule": removedResourceWrapper(resourceNsxtNatRule, "nsxt_nat_rule"),
"nsxt_ip_block": removedResourceWrapper(resourceNsxtIPBlock, "nsxt_ip_block"),
"nsxt_ip_block_subnet": removedResourceWrapper(resourceNsxtIPBlockSubnet, "nsxt_ip_block_subnet"),
"nsxt_ip_pool": removedResourceWrapper(resourceNsxtIPPool, "nsxt_ip_pool"),
"nsxt_ip_pool_allocation_ip_address": removedResourceWrapper(resourceNsxtIPPoolAllocationIPAddress, "nsxt_ip_pool_allocation_ip_address"),
"nsxt_ip_set": removedResourceWrapper(resourceNsxtIPSet, "nsxt_ip_set"),
"nsxt_static_route": removedResourceWrapper(resourceNsxtStaticRoute, "nsxt_static_route"),
"nsxt_vm_tags": removedResourceWrapper(resourceNsxtVMTags, "nsxt_vm_tags"),
"nsxt_lb_icmp_monitor": removedResourceWrapper(resourceNsxtLbIcmpMonitor, "nsxt_lb_icmp_monitor"),
"nsxt_lb_tcp_monitor": removedResourceWrapper(resourceNsxtLbTCPMonitor, "nsxt_lb_tcp_monitor"),
"nsxt_lb_udp_monitor": removedResourceWrapper(resourceNsxtLbUDPMonitor, "nsxt_lb_udp_monitor"),
"nsxt_lb_http_monitor": removedResourceWrapper(resourceNsxtLbHTTPMonitor, "nsxt_lb_http_monitor"),
"nsxt_lb_https_monitor": removedResourceWrapper(resourceNsxtLbHTTPSMonitor, "nsxt_lb_https_monitor"),
"nsxt_lb_passive_monitor": removedResourceWrapper(resourceNsxtLbPassiveMonitor, "nsxt_lb_passive_monitor"),
"nsxt_lb_pool": removedResourceWrapper(resourceNsxtLbPool, "nsxt_lb_pool"),
"nsxt_lb_tcp_virtual_server": removedResourceWrapper(resourceNsxtLbTCPVirtualServer, "nsxt_lb_tcp_virtual_server"),
"nsxt_lb_udp_virtual_server": removedResourceWrapper(resourceNsxtLbUDPVirtualServer, "nsxt_lb_udp_virtual_server"),
"nsxt_lb_http_virtual_server": removedResourceWrapper(resourceNsxtLbHTTPVirtualServer, "nsxt_lb_http_virtual_server"),
"nsxt_lb_http_forwarding_rule": removedResourceWrapper(resourceNsxtLbHTTPForwardingRule, "nsxt_lb_http_forwarding_rule"),
"nsxt_lb_http_request_rewrite_rule": removedResourceWrapper(resourceNsxtLbHTTPRequestRewriteRule, "nsxt_lb_http_request_rewrite_rule"),
"nsxt_lb_http_response_rewrite_rule": removedResourceWrapper(resourceNsxtLbHTTPResponseRewriteRule, "nsxt_lb_http_response_rewrite_rule"),
"nsxt_lb_cookie_persistence_profile": removedResourceWrapper(resourceNsxtLbCookiePersistenceProfile, "nsxt_lb_cookie_persistence_profile"),
"nsxt_lb_source_ip_persistence_profile": removedResourceWrapper(resourceNsxtLbSourceIPPersistenceProfile, "nsxt_lb_source_ip_persistence_profile"),
"nsxt_lb_client_ssl_profile": removedResourceWrapper(resourceNsxtLbClientSslProfile, "nsxt_lb_client_ssl_profile"),
"nsxt_lb_server_ssl_profile": removedResourceWrapper(resourceNsxtLbServerSslProfile, "nsxt_lb_server_ssl_profile"),
"nsxt_lb_service": removedResourceWrapper(resourceNsxtLbService, "nsxt_lb_service"),
"nsxt_lb_fast_tcp_application_profile": removedResourceWrapper(resourceNsxtLbFastTCPApplicationProfile, "nsxt_lb_fast_tcp_application_profile"),
"nsxt_lb_fast_udp_application_profile": removedResourceWrapper(resourceNsxtLbFastUDPApplicationProfile, "nsxt_lb_fast_udp_application_profile"),
"nsxt_lb_http_application_profile": removedResourceWrapper(resourceNsxtLbHTTPApplicationProfile, "nsxt_lb_http_application_profile"),
"nsxt_policy_tier1_gateway": resourceNsxtPolicyTier1Gateway(),
"nsxt_policy_tier1_gateway_interface": resourceNsxtPolicyTier1GatewayInterface(),
"nsxt_policy_tier0_gateway": resourceNsxtPolicyTier0Gateway(),
Expand Down
Loading

0 comments on commit db61285

Please sign in to comment.