diff --git a/nsxt/data_source_nsxt_policy_dhcp_server_test.go b/nsxt/data_source_nsxt_policy_dhcp_server_test.go index 6a6a4dc57..e883c6970 100644 --- a/nsxt/data_source_nsxt_policy_dhcp_server_test.go +++ b/nsxt/data_source_nsxt_policy_dhcp_server_test.go @@ -21,6 +21,13 @@ func TestAccDataSourceNsxtPolicyDhcpServer_multitenancy(t *testing.T) { }) } +func TestAccDataSourceNsxtPolicyDhcpServer_multitenancyProvider(t *testing.T) { + testAccDataSourceNsxtPolicyDhcpServerBasic(t, false, func() { + testAccPreCheck(t) + testAccOnlyMultitenancyProvider(t) + }) +} + func testAccDataSourceNsxtPolicyDhcpServerBasic(t *testing.T, withContext bool, preCheck func()) { name := getAccTestDataSourceName() testResourceName := "data.nsxt_policy_dhcp_server.test" diff --git a/nsxt/data_source_nsxt_policy_gateway_locale_service_test.go b/nsxt/data_source_nsxt_policy_gateway_locale_service_test.go index e2c2ac8ff..32bd152d5 100644 --- a/nsxt/data_source_nsxt_policy_gateway_locale_service_test.go +++ b/nsxt/data_source_nsxt_policy_gateway_locale_service_test.go @@ -88,6 +88,13 @@ func TestAccDataSourceNsxtPolicyGatewayLocaleService_multitenancy(t *testing.T) }) } +func TestAccDataSourceNsxtPolicyGatewayLocaleService_multitenancyProvider(t *testing.T) { + testAccDataSourceNsxtPolicyGatewayLocaleServiceDefault(t, false, func() { + testAccPreCheck(t) + testAccOnlyMultitenancyProvider(t) + }) +} + func testAccNsxtPolicyGatewayLocaleServiceTemplate(name string, withContext bool) string { context := "" if withContext { diff --git a/nsxt/data_source_nsxt_policy_gateway_policy_test.go b/nsxt/data_source_nsxt_policy_gateway_policy_test.go index 0bd4ff7c8..a85148441 100644 --- a/nsxt/data_source_nsxt_policy_gateway_policy_test.go +++ b/nsxt/data_source_nsxt_policy_gateway_policy_test.go @@ -22,6 +22,13 @@ func TestAccDataSourceNsxtPolicyGatewayPolicy_multitenancy(t *testing.T) { }) } +func TestAccDataSourceNsxtPolicyGatewayPolicy_multitenancyProvider(t *testing.T) { + testAccDataSourceNsxtPolicyGatewayPolicyBasic(t, false, func() { + testAccPreCheck(t) + testAccOnlyMultitenancyProvider(t) + }) +} + func testAccDataSourceNsxtPolicyGatewayPolicyBasic(t *testing.T, withContext bool, preCheck func()) { name := getAccTestDataSourceName() category := "LocalGatewayRules" diff --git a/nsxt/data_source_nsxt_policy_gateway_qos_profile_test.go b/nsxt/data_source_nsxt_policy_gateway_qos_profile_test.go index e00872f3e..1975f2ebd 100644 --- a/nsxt/data_source_nsxt_policy_gateway_qos_profile_test.go +++ b/nsxt/data_source_nsxt_policy_gateway_qos_profile_test.go @@ -30,6 +30,13 @@ func TestAccDataSourceNsxtPolicyGatewayQosProfile_multitenancy(t *testing.T) { }) } +func TestAccDataSourceNsxtPolicyGatewayQosProfile_multitenancyProvider(t *testing.T) { + testAccDataSourceNsxtPolicyGatewayQosProfileBasic(t, false, func() { + testAccPreCheck(t) + testAccOnlyMultitenancyProvider(t) + }) +} + func testAccDataSourceNsxtPolicyGatewayQosProfileBasic(t *testing.T, withContext bool, preCheck func()) { name := getAccTestDataSourceName() testResourceName := "data.nsxt_policy_gateway_qos_profile.test" diff --git a/nsxt/data_source_nsxt_policy_group_test.go b/nsxt/data_source_nsxt_policy_group_test.go index 20d13b278..94bf28fe8 100644 --- a/nsxt/data_source_nsxt_policy_group_test.go +++ b/nsxt/data_source_nsxt_policy_group_test.go @@ -27,6 +27,13 @@ func TestAccDataSourceNsxtPolicyGroup_multitenancy(t *testing.T) { }) } +func TestAccDataSourceNsxtPolicyGroup_multitenancyProvider(t *testing.T) { + testAccDataSourceNsxtPolicyGroupBasic(t, false, func() { + testAccPreCheck(t) + testAccOnlyMultitenancyProvider(t) + }) +} + func testAccDataSourceNsxtPolicyGroupBasic(t *testing.T, withContext bool, preCheck func()) { name := getAccTestDataSourceName() domain := "default" diff --git a/nsxt/data_source_nsxt_policy_intrusion_service_profile_test.go b/nsxt/data_source_nsxt_policy_intrusion_service_profile_test.go index 286f80b9d..e18c8a8c5 100644 --- a/nsxt/data_source_nsxt_policy_intrusion_service_profile_test.go +++ b/nsxt/data_source_nsxt_policy_intrusion_service_profile_test.go @@ -49,6 +49,13 @@ func TestAccDataSourceNsxtPolicyIntrusionServiceProfile_multitenancy(t *testing. }) } +func TestAccDataSourceNsxtPolicyIntrusionServiceProfile_multitenancyProvider(t *testing.T) { + testAccDataSourceNsxtPolicyIntrusionServiceProfileBasic(t, false, func() { + testAccPreCheck(t) + testAccOnlyMultitenancyProvider(t) + }) +} + func testAccDataSourceNsxtPolicyIntrusionServiceProfileBasic(t *testing.T, withContext bool, preCheck func()) { name := getAccTestResourceName() testResourceName := "data.nsxt_policy_intrusion_service_profile.test" diff --git a/nsxt/data_source_nsxt_policy_ip_block_test.go b/nsxt/data_source_nsxt_policy_ip_block_test.go index 46c4e8a6b..63cf57f85 100644 --- a/nsxt/data_source_nsxt_policy_ip_block_test.go +++ b/nsxt/data_source_nsxt_policy_ip_block_test.go @@ -29,6 +29,13 @@ func TestAccDataSourceNsxtPolicyIpBlock_multitenancy(t *testing.T) { }) } +func TestAccDataSourceNsxtPolicyIpBlock_multitenancyProvider(t *testing.T) { + testAccDataSourceNsxtPolicyIPBlockBasic(t, false, func() { + testAccPreCheck(t) + testAccOnlyMultitenancyProvider(t) + }) +} + func testAccDataSourceNsxtPolicyIPBlockBasic(t *testing.T, withContext bool, preCheck func()) { name := getAccTestDataSourceName() testResourceName := "data.nsxt_policy_ip_block.test" diff --git a/nsxt/data_source_nsxt_policy_ip_pool_test.go b/nsxt/data_source_nsxt_policy_ip_pool_test.go index f749cdd06..0c8e1cdba 100644 --- a/nsxt/data_source_nsxt_policy_ip_pool_test.go +++ b/nsxt/data_source_nsxt_policy_ip_pool_test.go @@ -28,6 +28,13 @@ func TestAccDataSourceNsxtPolicyIpPool_multitenancy(t *testing.T) { }) } +func TestAccDataSourceNsxtPolicyIpPool_multitenancyProvider(t *testing.T) { + testAccDataSourceNsxtPolicyIPPoolBasic(t, false, func() { + testAccPreCheck(t) + testAccOnlyMultitenancyProvider(t) + }) +} + func testAccDataSourceNsxtPolicyIPPoolBasic(t *testing.T, withContext bool, preCheck func()) { name := getAccTestDataSourceName() testResourceName := "data.nsxt_policy_ip_pool.test" diff --git a/nsxt/data_source_nsxt_policy_ipv6_dad_profile_test.go b/nsxt/data_source_nsxt_policy_ipv6_dad_profile_test.go index 91634b5c3..46d1e3a93 100644 --- a/nsxt/data_source_nsxt_policy_ipv6_dad_profile_test.go +++ b/nsxt/data_source_nsxt_policy_ipv6_dad_profile_test.go @@ -27,6 +27,13 @@ func TestAccDataSourceNsxtPolicyIpv6DadProfile_multitenancy(t *testing.T) { }) } +func TestAccDataSourceNsxtPolicyIpv6DadProfile_multitenancyProvider(t *testing.T) { + testAccDataSourceNsxtPolicyIpv6DadProfileBasic(t, false, func() { + testAccPreCheck(t) + testAccOnlyMultitenancyProvider(t) + }) +} + func testAccDataSourceNsxtPolicyIpv6DadProfileBasic(t *testing.T, withContext bool, preCheck func()) { name := getAccTestDataSourceName() testResourceName := "data.nsxt_policy_ipv6_dad_profile.test" diff --git a/nsxt/data_source_nsxt_policy_ipv6_ndra_profile_test.go b/nsxt/data_source_nsxt_policy_ipv6_ndra_profile_test.go index d2e00b3bd..7d073275b 100644 --- a/nsxt/data_source_nsxt_policy_ipv6_ndra_profile_test.go +++ b/nsxt/data_source_nsxt_policy_ipv6_ndra_profile_test.go @@ -27,6 +27,13 @@ func TestAccDataSourceNsxtPolicyIpv6NdraProfile_multitenancy(t *testing.T) { }) } +func TestAccDataSourceNsxtPolicyIpv6NdraProfile_multitenancyProvider(t *testing.T) { + testAccDataSourceNsxtPolicyIpv6NdraProfileBasic(t, false, func() { + testAccPreCheck(t) + testAccOnlyMultitenancyProvider(t) + }) +} + func testAccDataSourceNsxtPolicyIpv6NdraProfileBasic(t *testing.T, withContext bool, preCheck func()) { name := getAccTestDataSourceName() testResourceName := "data.nsxt_policy_ipv6_ndra_profile.test" diff --git a/nsxt/data_source_nsxt_policy_mac_discovery_profile_test.go b/nsxt/data_source_nsxt_policy_mac_discovery_profile_test.go index f09c7aaa2..2353b86d2 100644 --- a/nsxt/data_source_nsxt_policy_mac_discovery_profile_test.go +++ b/nsxt/data_source_nsxt_policy_mac_discovery_profile_test.go @@ -64,7 +64,29 @@ func TestAccDataSourceNsxtPolicyMacDiscoveryProfile_multitenancy(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccNsxtPolicyMacDiscoveryProfileMultitenancyTemplate(name), + Config: testAccNsxtPolicyMacDiscoveryProfileMultitenancyTemplate(name, true), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr(testResourceName, "display_name", name), + resource.TestCheckResourceAttrSet(testResourceName, "path"), + ), + }, + }, + }) +} + +func TestAccDataSourceNsxtPolicyMacDiscoveryProfile_multitenancyProvider(t *testing.T) { + name := getAccTestResourceName() + testResourceName := "data.nsxt_policy_mac_discovery_profile.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { + testAccPreCheck(t) + testAccOnlyMultitenancyProvider(t) + }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccNsxtPolicyMacDiscoveryProfileMultitenancyTemplate(name, false), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr(testResourceName, "display_name", name), resource.TestCheckResourceAttrSet(testResourceName, "path"), @@ -81,8 +103,11 @@ data "nsxt_policy_mac_discovery_profile" "test" { }`, name) } -func testAccNsxtPolicyMacDiscoveryProfileMultitenancyTemplate(name string) string { - context := testAccNsxtPolicyMultitenancyContext() +func testAccNsxtPolicyMacDiscoveryProfileMultitenancyTemplate(name string, withContext bool) string { + context := "" + if withContext { + context = testAccNsxtPolicyMultitenancyContext() + } return fmt.Sprintf(` resource "nsxt_policy_mac_discovery_profile" "test" { %s diff --git a/nsxt/data_source_nsxt_policy_qos_profile_test.go b/nsxt/data_source_nsxt_policy_qos_profile_test.go index c5474c17b..233a9d3cc 100644 --- a/nsxt/data_source_nsxt_policy_qos_profile_test.go +++ b/nsxt/data_source_nsxt_policy_qos_profile_test.go @@ -27,6 +27,13 @@ func TestAccDataSourceNsxtPolicyQosProfile_multitenancy(t *testing.T) { }) } +func TestAccDataSourceNsxtPolicyQosProfile_multitenancyProvider(t *testing.T) { + testAccDataSourceNsxtPolicyQosProfileBasic(t, false, func() { + testAccPreCheck(t) + testAccOnlyMultitenancyProvider(t) + }) +} + func testAccDataSourceNsxtPolicyQosProfileBasic(t *testing.T, withContext bool, preCheck func()) { name := getAccTestDataSourceName() testResourceName := "data.nsxt_policy_qos_profile.test" diff --git a/nsxt/data_source_nsxt_policy_realization_info_test.go b/nsxt/data_source_nsxt_policy_realization_info_test.go index 12b57dfba..00671f2c2 100644 --- a/nsxt/data_source_nsxt_policy_realization_info_test.go +++ b/nsxt/data_source_nsxt_policy_realization_info_test.go @@ -25,6 +25,13 @@ func TestAccDataSourceNsxtPolicyRealizationInfo_tier1DataSource_multitenancy(t * }) } +func TestAccDataSourceNsxtPolicyRealizationInfo_tier1DataSource_multitenancyProvider(t *testing.T) { + testAccDataSourceNsxtPolicyRealizationInfoTier1DataSource(t, false, func() { + testAccPreCheck(t) + testAccOnlyMultitenancyProvider(t) + }) +} + func testAccDataSourceNsxtPolicyRealizationInfoTier1DataSource(t *testing.T, withContext bool, preCheck func()) { resourceDataType := "nsxt_policy_tier1_gateway" resourceName := getAccTestDataSourceName() @@ -117,6 +124,14 @@ func TestAccDataSourceNsxtPolicyRealizationInfo_tier1Resource_multitenancy(t *te }) } +func TestAccDataSourceNsxtPolicyRealizationInfo_tier1Resource_multitenancyProvider(t *testing.T) { + testAccDataSourceNsxtPolicyRealizationInfoTier1Resource(t, false, func() { + testAccPreCheck(t) + testAccNSXVersion(t, "3.0.0") + testAccOnlyMultitenancyProvider(t) + }) +} + func testAccDataSourceNsxtPolicyRealizationInfoTier1Resource(t *testing.T, withContext bool, preCheck func()) { resourceType := "nsxt_policy_tier1_gateway" resourceName := getAccTestDataSourceName() diff --git a/nsxt/data_source_nsxt_policy_security_policy_test.go b/nsxt/data_source_nsxt_policy_security_policy_test.go index 9df88b0af..4cdee0513 100644 --- a/nsxt/data_source_nsxt_policy_security_policy_test.go +++ b/nsxt/data_source_nsxt_policy_security_policy_test.go @@ -24,6 +24,13 @@ func TestAccDataSourceNsxtPolicySecurityPolicy_multitenancy(t *testing.T) { }) } +func TestAccDataSourceNsxtPolicySecurityPolicy_multitenancyProvider(t *testing.T) { + testAccDataSourceNsxtPolicySecurityPolicyBasic(t, false, func() { + testAccPreCheck(t) + testAccOnlyMultitenancyProvider(t) + }) +} + func testAccDataSourceNsxtPolicySecurityPolicyBasic(t *testing.T, withContext bool, preCheck func()) { name := getAccTestDataSourceName() category := "Application" diff --git a/nsxt/data_source_nsxt_policy_segment_realization_test.go b/nsxt/data_source_nsxt_policy_segment_realization_test.go index a368eac96..5d54576f9 100644 --- a/nsxt/data_source_nsxt_policy_segment_realization_test.go +++ b/nsxt/data_source_nsxt_policy_segment_realization_test.go @@ -52,6 +52,13 @@ func TestAccDataSourceNsxtPolicySegmentRealization_multitenancy(t *testing.T) { }) } +func TestAccDataSourceNsxtPolicySegmentRealization_multitenancyProvider(t *testing.T) { + testAccDataSourceNsxtPolicySegmentRealization(t, false, false, func() { + testAccPreCheck(t) + testAccOnlyMultitenancyProvider(t) + }) +} + func testAccNsxtPolicySegmentRealizationTemplate(vlan, withContext bool) string { resource := "nsxt_policy_segment" tz := getOverlayTransportZoneName() diff --git a/nsxt/data_source_nsxt_policy_segment_test.go b/nsxt/data_source_nsxt_policy_segment_test.go index 69305f547..1a7474490 100644 --- a/nsxt/data_source_nsxt_policy_segment_test.go +++ b/nsxt/data_source_nsxt_policy_segment_test.go @@ -28,6 +28,13 @@ func TestAccDataSourceNsxtPolicySegment_multitenancy(t *testing.T) { }) } +func TestAccDataSourceNsxtPolicySegment_multitenancyProvider(t *testing.T) { + testAccDataSourceNsxtPolicySegmentBasic(t, false, func() { + testAccPreCheck(t) + testAccOnlyMultitenancyProvider(t) + }) +} + func testAccDataSourceNsxtPolicySegmentBasic(t *testing.T, withContext bool, preCheck func()) { name := getAccTestDataSourceName() testResourceName := "data.nsxt_policy_segment.test" diff --git a/nsxt/data_source_nsxt_policy_tier1_gateway_test.go b/nsxt/data_source_nsxt_policy_tier1_gateway_test.go index 1d93c9055..24fab8438 100644 --- a/nsxt/data_source_nsxt_policy_tier1_gateway_test.go +++ b/nsxt/data_source_nsxt_policy_tier1_gateway_test.go @@ -27,6 +27,13 @@ func TestAccDataSourceNsxtPolicyTier1Gateway_multitenancy(t *testing.T) { }) } +func TestAccDataSourceNsxtPolicyTier1Gateway_multitenancyProvider(t *testing.T) { + testAccDataSourceNsxtPolicyTier1GatewayBasic(t, false, func() { + testAccPreCheck(t) + testAccOnlyMultitenancyProvider(t) + }) +} + func testAccDataSourceNsxtPolicyTier1GatewayBasic(t *testing.T, withContext bool, preCheck func()) { routerName := getAccTestDataSourceName() testResourceName := "data.nsxt_policy_tier1_gateway.test" diff --git a/nsxt/data_source_nsxt_policy_vm_test.go b/nsxt/data_source_nsxt_policy_vm_test.go index 3038010fe..534d4e432 100644 --- a/nsxt/data_source_nsxt_policy_vm_test.go +++ b/nsxt/data_source_nsxt_policy_vm_test.go @@ -27,6 +27,14 @@ func TestAccDataSourceNsxtPolicyVM_multitenancy(t *testing.T) { testAccEnvDefined(t, "NSXT_TEST_VM_NAME") }) } +func TestAccDataSourceNsxtPolicyVM_multitenancyProvider(t *testing.T) { + testAccDataSourceNsxtPolicyVMBasic(t, false, func() { + testAccPreCheck(t) + testAccOnlyMultitenancyProvider(t) + testAccEnvDefined(t, "NSXT_TEST_VM_ID") + testAccEnvDefined(t, "NSXT_TEST_VM_NAME") + }) +} func testAccDataSourceNsxtPolicyVMBasic(t *testing.T, withContext bool, preCheck func()) { testResourceName := "data.nsxt_policy_vm.test" diff --git a/nsxt/data_source_nsxt_policy_vms_test.go b/nsxt/data_source_nsxt_policy_vms_test.go index 824ec386b..6186d9390 100644 --- a/nsxt/data_source_nsxt_policy_vms_test.go +++ b/nsxt/data_source_nsxt_policy_vms_test.go @@ -19,13 +19,21 @@ func TestAccDataSourceNsxtPolicyVMs_basic(t *testing.T) { } func TestAccDataSourceNsxtPolicyVMs_multitenancy(t *testing.T) { - testAccDataSourceNsxtPolicyVMsBasic(t, false, func() { + testAccDataSourceNsxtPolicyVMsBasic(t, true, func() { testAccPreCheck(t) testAccOnlyMultitenancy(t) testAccEnvDefined(t, "NSXT_TEST_VM_NAME") }) } +func TestAccDataSourceNsxtPolicyVMs_multitenancyProvider(t *testing.T) { + testAccDataSourceNsxtPolicyVMsBasic(t, false, func() { + testAccPreCheck(t) + testAccOnlyMultitenancyProvider(t) + testAccEnvDefined(t, "NSXT_TEST_VM_NAME") + }) +} + func testAccDataSourceNsxtPolicyVMsBasic(t *testing.T, withContext bool, preCheck func()) { testResourceName := "data.nsxt_policy_vms.test" checkDataSourceName := "data.nsxt_policy_vm.check" diff --git a/nsxt/data_source_policy_vpc_test.go b/nsxt/data_source_policy_vpc_test.go index 23d7caa0b..73c64150b 100644 --- a/nsxt/data_source_policy_vpc_test.go +++ b/nsxt/data_source_policy_vpc_test.go @@ -35,7 +35,40 @@ func TestAccDataSourceNsxtPolicyVPC_basic_multitenancy(t *testing.T) { t.Error(err) } }, - Config: testAccNsxtPolicyVPCReadTemplate(name), + Config: testAccNsxtPolicyVPCReadTemplate(name, true), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr(testResourceName, "display_name", name), + resource.TestCheckResourceAttr(testResourceName, "description", name), + resource.TestCheckResourceAttrSet(testResourceName, "path"), + resource.TestCheckResourceAttrSet(testResourceName, "short_id"), + ), + }, + }, + }) +} + +func TestAccDataSourceNsxtPolicyVPC_basic_multitenancyProvider(t *testing.T) { + name := getAccTestDataSourceName() + testResourceName := "data.nsxt_policy_vpc.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { + testAccOnlyMultitenancyProvider(t) + testAccPreCheck(t) + testAccNSXVersion(t, "4.1.2") + }, + Providers: testAccProviders, + CheckDestroy: func(state *terraform.State) error { + return testAccDataSourceNsxtPolicyVPCDeleteByName(name) + }, + Steps: []resource.TestStep{ + { + PreConfig: func() { + if err := testAccDataSourceNsxtPolicyVPCCreate(name); err != nil { + t.Error(err) + } + }, + Config: testAccNsxtPolicyVPCReadTemplate(name, false), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr(testResourceName, "display_name", name), resource.TestCheckResourceAttr(testResourceName, "description", name), @@ -113,8 +146,11 @@ func testAccDataSourceNsxtPolicyVPCDeleteByName(name string) error { return fmt.Errorf("error while deleting VPC '%s': resource not found", name) } -func testAccNsxtPolicyVPCReadTemplate(name string) string { - context := testAccNsxtPolicyMultitenancyContext() +func testAccNsxtPolicyVPCReadTemplate(name string, withContext bool) string { + context := "" + if withContext { + context = testAccNsxtPolicyMultitenancyContext() + } return fmt.Sprintf(` data "nsxt_policy_ip_block" "test" { %s diff --git a/nsxt/resource_nsxt_policy_context_profile_custom_attribute_test.go b/nsxt/resource_nsxt_policy_context_profile_custom_attribute_test.go index b4423d39b..42c41347a 100644 --- a/nsxt/resource_nsxt_policy_context_profile_custom_attribute_test.go +++ b/nsxt/resource_nsxt_policy_context_profile_custom_attribute_test.go @@ -30,6 +30,13 @@ func TestAccResourceNsxtPolicyContextProfileCustomAttribute_multitenancy(t *test }) } +func TestAccResourceNsxtPolicyContextProfileCustomAttribute_multitenancyProvider(t *testing.T) { + testAccResourceNsxtPolicyContextProfileCustomAttributeBasic(t, false, func() { + testAccPreCheck(t) + testAccOnlyMultitenancyProvider(t) + }) +} + func testAccResourceNsxtPolicyContextProfileCustomAttributeBasic(t *testing.T, withContext bool, preCheck func()) { testResourceName := "nsxt_policy_context_profile_custom_attribute.test" diff --git a/nsxt/resource_nsxt_policy_context_profile_test.go b/nsxt/resource_nsxt_policy_context_profile_test.go index eed1a5b42..913bc5002 100644 --- a/nsxt/resource_nsxt_policy_context_profile_test.go +++ b/nsxt/resource_nsxt_policy_context_profile_test.go @@ -30,6 +30,13 @@ func TestAccResourceNsxtPolicyContextProfile_multitenancy(t *testing.T) { }) } +func TestAccResourceNsxtPolicyContextProfile_multitenancyProvider(t *testing.T) { + testAccResourceNsxtPolicyContextProfileBasic(t, false, func() { + testAccPreCheck(t) + testAccOnlyMultitenancyProvider(t) + }) +} + func testAccResourceNsxtPolicyContextProfileBasic(t *testing.T, withContext bool, preCheck func()) { name := getAccTestResourceName() updatedName := getAccTestResourceName() @@ -165,6 +172,31 @@ func TestAccResourceNsxtPolicyContextProfile_importBasic_multitenancy(t *testing }) } +func TestAccResourceNsxtPolicyContextProfile_importBasic_multitenancyProvider(t *testing.T) { + name := getAccTestResourceName() + testResourceName := "nsxt_policy_context_profile.test" + attributes := testAccNsxtPolicyContextProfileAttributeDomainNameTemplate(testSystemDomainName) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t); testAccOnlyMultitenancyProvider(t) }, + Providers: testAccProviders, + CheckDestroy: func(state *terraform.State) error { + return testAccNsxtPolicyContextProfileCheckDestroy(state, name) + }, + Steps: []resource.TestStep{ + { + Config: testAccNsxtPolicyContextProfileTemplate(name, attributes, false), + }, + { + ResourceName: testResourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateIdFunc: testAccResourceNsxtPolicyImportIDRetriever(testResourceName), + }, + }, + }) +} + func TestAccResourceNsxtPolicyContextProfile_multipleAttributes(t *testing.T) { name := getAccTestResourceName() updatedName := getAccTestResourceName() diff --git a/nsxt/resource_nsxt_policy_dhcp_relay_test.go b/nsxt/resource_nsxt_policy_dhcp_relay_test.go index dd97b2f43..56e9025c2 100644 --- a/nsxt/resource_nsxt_policy_dhcp_relay_test.go +++ b/nsxt/resource_nsxt_policy_dhcp_relay_test.go @@ -36,6 +36,13 @@ func TestAccResourceNsxtPolicyDhcpRelayConfig_multitenancy(t *testing.T) { }) } +func TestAccResourceNsxtPolicyDhcpRelayConfig_multitenancyProvider(t *testing.T) { + testAccResourceNsxtPolicyDhcpRelayConfigBasic(t, false, func() { + testAccPreCheck(t) + testAccOnlyMultitenancyProvider(t) + }) +} + // NOTE: Realization is not tested here. Relay config is only realized when segment uses it. func testAccResourceNsxtPolicyDhcpRelayConfigBasic(t *testing.T, withContext bool, preCheck func()) { testResourceName := "nsxt_policy_dhcp_relay.test" @@ -137,6 +144,30 @@ func TestAccResourceNsxtPolicyDhcpRelayConfig_importBasic_multitenancy(t *testin }) } +func TestAccResourceNsxtPolicyDhcpRelayConfig_importBasic_multitenancyProvider(t *testing.T) { + name := getAccTestResourceName() + testResourceName := "nsxt_policy_dhcp_relay.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t); testAccOnlyMultitenancyProvider(t) }, + Providers: testAccProviders, + CheckDestroy: func(state *terraform.State) error { + return testAccNsxtPolicyDhcpRelayConfigCheckDestroy(state, name) + }, + Steps: []resource.TestStep{ + { + Config: testAccNsxtPolicyDhcpRelayConfigMinimalistic(false), + }, + { + ResourceName: testResourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateIdFunc: testAccResourceNsxtPolicyImportIDRetriever(testResourceName), + }, + }, + }) +} + func testAccNsxtPolicyDhcpRelayConfigExists(resourceName string) resource.TestCheckFunc { return func(state *terraform.State) error { diff --git a/nsxt/resource_nsxt_policy_dhcp_server_test.go b/nsxt/resource_nsxt_policy_dhcp_server_test.go index 734a5b89e..8903bbfd4 100644 --- a/nsxt/resource_nsxt_policy_dhcp_server_test.go +++ b/nsxt/resource_nsxt_policy_dhcp_server_test.go @@ -38,6 +38,13 @@ func TestAccResourceNsxtPolicyDhcpServer_multitenancy(t *testing.T) { }) } +func TestAccResourceNsxtPolicyDhcpServer_multitenancyProvider(t *testing.T) { + testAccResourceNsxtPolicyDhcpServerBasic(t, false, func() { + testAccPreCheck(t) + testAccOnlyMultitenancyProvider(t) + }) +} + func testAccResourceNsxtPolicyDhcpServerBasic(t *testing.T, withContext bool, preCheck func()) { testResourceName := "nsxt_policy_dhcp_server.test" @@ -146,6 +153,30 @@ func TestAccResourceNsxtPolicyDhcpServer_importBasic_multitenancy(t *testing.T) }) } +func TestAccResourceNsxtPolicyDhcpServer_importBasic_multitenancyProvider(t *testing.T) { + name := getAccTestResourceName() + testResourceName := "nsxt_policy_dhcp_server.test" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t); testAccOnlyMultitenancyProvider(t) }, + Providers: testAccProviders, + CheckDestroy: func(state *terraform.State) error { + return testAccNsxtPolicyDhcpServerCheckDestroy(state, name) + }, + Steps: []resource.TestStep{ + { + Config: testAccNsxtPolicyDhcpServerMinimalistic(false), + }, + { + ResourceName: testResourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateIdFunc: testAccResourceNsxtPolicyImportIDRetriever(testResourceName), + }, + }, + }) +} + func testAccNsxtPolicyDhcpServerExists(resourceName string) resource.TestCheckFunc { return func(state *terraform.State) error { diff --git a/nsxt/resource_nsxt_policy_dhcp_v4_static_binding_test.go b/nsxt/resource_nsxt_policy_dhcp_v4_static_binding_test.go index 4dc4527d6..240ab92cd 100644 --- a/nsxt/resource_nsxt_policy_dhcp_v4_static_binding_test.go +++ b/nsxt/resource_nsxt_policy_dhcp_v4_static_binding_test.go @@ -60,6 +60,13 @@ func TestAccResourceNsxtPolicyDhcpV4StaticBinding_multitenancy(t *testing.T) { }) } +func TestAccResourceNsxtPolicyDhcpV4StaticBinding_multitenancyProvider(t *testing.T) { + testAccResourceNsxtPolicyDhcpV4StaticBindingBasic(t, false, false, func() { + testAccPreCheck(t) + testAccOnlyMultitenancyProvider(t) + }) +} + func TestAccResourceNsxtPolicyDhcpV4StaticBinding_fixedSegment(t *testing.T) { testAccResourceNsxtPolicyDhcpV4StaticBindingBasic(t, true, false, func() { testAccPreCheck(t) @@ -75,6 +82,13 @@ func TestAccResourceNsxtPolicyDhcpV4StaticBinding_fixedSegment_multitenancy(t *t }) } +func TestAccResourceNsxtPolicyDhcpV4StaticBinding_fixedSegment_multitenancyProvider(t *testing.T) { + testAccResourceNsxtPolicyDhcpV4StaticBindingBasic(t, true, false, func() { + testAccPreCheck(t) + testAccOnlyMultitenancyProvider(t) + }) +} + func testAccResourceNsxtPolicyDhcpV4StaticBindingBasic(t *testing.T, isFixed, withContext bool, preCheck func()) { testResourceName := testAccPolicyDhcpV4StaticBindingResourceName @@ -182,6 +196,29 @@ func TestAccResourceNsxtPolicyDhcpV4StaticBinding_importBasic_multitenancy(t *te }) } +func TestAccResourceNsxtPolicyDhcpV4StaticBinding_importBasic_multitenancyProvider(t *testing.T) { + name := getAccTestResourceName() + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t); testAccOnlyMultitenancyProvider(t) }, + Providers: testAccProviders, + CheckDestroy: func(state *terraform.State) error { + return testAccNsxtPolicyDhcpV4StaticBindingCheckDestroy(state, name) + }, + Steps: []resource.TestStep{ + { + Config: testAccNsxtPolicyDhcpV4StaticBindingMinimalistic(false, false), + }, + { + ResourceName: testAccPolicyDhcpV4StaticBindingResourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateIdFunc: testAccResourceNsxtPolicyImportIDRetriever(testAccPolicyDhcpV4StaticBindingResourceName), + }, + }, + }) +} + func testAccNsxtPolicyDhcpV4StaticBindingExists(displayName string, resourceName string) resource.TestCheckFunc { return func(state *terraform.State) error { diff --git a/nsxt/resource_nsxt_policy_dhcp_v6_static_binding_test.go b/nsxt/resource_nsxt_policy_dhcp_v6_static_binding_test.go index 3141586a9..7558638cb 100644 --- a/nsxt/resource_nsxt_policy_dhcp_v6_static_binding_test.go +++ b/nsxt/resource_nsxt_policy_dhcp_v6_static_binding_test.go @@ -53,6 +53,13 @@ func TestAccResourceNsxtPolicyDhcpV6StaticBinding_multitenancy(t *testing.T) { }) } +func TestAccResourceNsxtPolicyDhcpV6StaticBinding_multitenancyProvider(t *testing.T) { + testAccResourceNsxtPolicyDhcpV6StaticBindingBasic(t, false, false, func() { + testAccPreCheck(t) + testAccOnlyMultitenancyProvider(t) + }) +} + func TestAccResourceNsxtPolicyDhcpV6StaticBinding_fixed(t *testing.T) { testAccResourceNsxtPolicyDhcpV6StaticBindingBasic(t, true, false, func() { testAccPreCheck(t) @@ -68,6 +75,13 @@ func TestAccResourceNsxtPolicyDhcpV6StaticBinding_fixed_multitenancy(t *testing. }) } +func TestAccResourceNsxtPolicyDhcpV6StaticBinding_fixed_multitenancyProvider(t *testing.T) { + testAccResourceNsxtPolicyDhcpV6StaticBindingBasic(t, true, false, func() { + testAccPreCheck(t) + testAccOnlyMultitenancyProvider(t) + }) +} + func testAccResourceNsxtPolicyDhcpV6StaticBindingBasic(t *testing.T, isFixed, withContext bool, preCheck func()) { testResourceName := testAccPolicyDhcpV6StaticBindingResourceName @@ -189,6 +203,29 @@ func TestAccResourceNsxtPolicyDhcpV6StaticBinding_importBasic_multitenancy(t *te }) } +func TestAccResourceNsxtPolicyDhcpV6StaticBinding_importBasic_multitenancyProvider(t *testing.T) { + name := getAccTestResourceName() + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t); testAccOnlyMultitenancyProvider(t) }, + Providers: testAccProviders, + CheckDestroy: func(state *terraform.State) error { + return testAccNsxtPolicyDhcpV6StaticBindingCheckDestroy(state, name) + }, + Steps: []resource.TestStep{ + { + Config: testAccNsxtPolicyDhcpV6StaticBindingMinimalistic(false, false), + }, + { + ResourceName: testAccPolicyDhcpV6StaticBindingResourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateIdFunc: testAccResourceNsxtPolicyImportIDRetriever(testAccPolicyDhcpV6StaticBindingResourceName), + }, + }, + }) +} + func testAccNsxtPolicyDhcpV6StaticBindingExists(displayName string, resourceName string) resource.TestCheckFunc { return func(state *terraform.State) error { diff --git a/nsxt/resource_nsxt_policy_distributed_flood_protection_profile_binding_test.go b/nsxt/resource_nsxt_policy_distributed_flood_protection_profile_binding_test.go index 9ec987acf..6a19884d1 100644 --- a/nsxt/resource_nsxt_policy_distributed_flood_protection_profile_binding_test.go +++ b/nsxt/resource_nsxt_policy_distributed_flood_protection_profile_binding_test.go @@ -37,6 +37,13 @@ func TestAccResourceNsxtPolicyDistributedFloodProtectionProfileBinding_multitena }) } +func TestAccResourceNsxtPolicyDistributedFloodProtectionProfileBinding_multitenancyProvider(t *testing.T) { + testAccResourceNsxtPolicyDistributedFloodProtectionProfileBindingBasic(t, false, func() { + testAccPreCheck(t) + testAccOnlyMultitenancyProvider(t) + }) +} + func testAccResourceNsxtPolicyDistributedFloodProtectionProfileBindingBasic(t *testing.T, withContext bool, preCheck func()) { testResourceName := "nsxt_policy_distributed_flood_protection_profile_binding.test" if withContext { @@ -99,6 +106,13 @@ func TestAccResourceNsxtPolicyDistributedFloodProtectionProfileBinding_importBas }) } +func TestAccResourceNsxtPolicyDistributedFloodProtectionProfileBinding_importBasic_multitenancyProvider(t *testing.T) { + testAccResourceNsxtPolicyDistributedFloodProtectionProfileBindingImportBasic(t, false, func() { + testAccPreCheck(t) + testAccOnlyMultitenancyProvider(t) + }) +} + func testAccResourceNsxtPolicyDistributedFloodProtectionProfileBindingImportBasic(t *testing.T, withContext bool, preCheck func()) { testResourceName := "nsxt_policy_distributed_flood_protection_profile_binding.test" if withContext { diff --git a/nsxt/resource_nsxt_policy_distributed_flood_protection_profile_test.go b/nsxt/resource_nsxt_policy_distributed_flood_protection_profile_test.go index 41530a004..782549b31 100644 --- a/nsxt/resource_nsxt_policy_distributed_flood_protection_profile_test.go +++ b/nsxt/resource_nsxt_policy_distributed_flood_protection_profile_test.go @@ -70,6 +70,13 @@ func TestAccResourceNsxtPolicyDistributedFloodProtectionProfile_multitenancy(t * }) } +func TestAccResourceNsxtPolicyDistributedFloodProtectionProfile_multitenancyProvider(t *testing.T) { + testAccResourceNsxtPolicyDistributedFloodProtectionProfileBasic(t, false, func() { + testAccPreCheck(t) + testAccOnlyMultitenancyProvider(t) + }) +} + func testAccResourceNsxtPolicyDistributedFloodProtectionProfileBasic(t *testing.T, withContext bool, preCheck func()) { testResourceName := "nsxt_policy_distributed_flood_protection_profile.test" if withContext { @@ -140,6 +147,13 @@ func TestAccResourceNsxtPolicyDistributedFloodProtectionProfile_importBasic_mult }) } +func TestAccResourceNsxtPolicyDistributedFloodProtectionProfile_importBasic_multitenancyProvider(t *testing.T) { + testAccResourceNsxtPolicyDistributedFloodProtectionProfileImportBasic(t, false, func() { + testAccPreCheck(t) + testAccOnlyMultitenancyProvider(t) + }) +} + func testAccResourceNsxtPolicyDistributedFloodProtectionProfileImportBasic(t *testing.T, withContext bool, preCheck func()) { name := getAccTestResourceName() testResourceName := "nsxt_policy_distributed_flood_protection_profile.test" diff --git a/nsxt/resource_nsxt_policy_dns_forwarder_zone_test.go b/nsxt/resource_nsxt_policy_dns_forwarder_zone_test.go index ef139d524..80daf2072 100644 --- a/nsxt/resource_nsxt_policy_dns_forwarder_zone_test.go +++ b/nsxt/resource_nsxt_policy_dns_forwarder_zone_test.go @@ -40,6 +40,13 @@ func TestAccResourceNsxtPolicyDNSForwarderZone_multitenancy(t *testing.T) { }) } +func TestAccResourceNsxtPolicyDNSForwarderZone_multitenancyProvider(t *testing.T) { + testAccResourceNsxtPolicyDNSForwarderZoneBasic(t, false, func() { + testAccPreCheck(t) + testAccOnlyMultitenancyProvider(t) + }) +} + func testAccResourceNsxtPolicyDNSForwarderZoneBasic(t *testing.T, withContext bool, preCheck func()) { testResourceName := "nsxt_policy_dns_forwarder_zone.test" @@ -150,6 +157,30 @@ func TestAccResourceNsxtPolicyDNSForwarderZone_importBasic_multitenancy(t *testi }) } +func TestAccResourceNsxtPolicyDNSForwarderZone_importBasic_multitenancyProvider(t *testing.T) { + name := getAccTestResourceName() + testResourceName := "nsxt_policy_dns_forwarder_zone.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t); testAccOnlyMultitenancyProvider(t) }, + Providers: testAccProviders, + CheckDestroy: func(state *terraform.State) error { + return testAccNsxtPolicyDNSForwarderZoneCheckDestroy(state, name) + }, + Steps: []resource.TestStep{ + { + Config: testAccNsxtPolicyDNSForwarderZoneMinimalistic(false), + }, + { + ResourceName: testResourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateIdFunc: testAccResourceNsxtPolicyImportIDRetriever(testResourceName), + }, + }, + }) +} + func testAccNsxtPolicyDNSForwarderZoneExists(displayName string, resourceName string) resource.TestCheckFunc { return func(state *terraform.State) error { diff --git a/nsxt/resource_nsxt_policy_fixed_segment_test.go b/nsxt/resource_nsxt_policy_fixed_segment_test.go index dd0568997..eba73c9db 100644 --- a/nsxt/resource_nsxt_policy_fixed_segment_test.go +++ b/nsxt/resource_nsxt_policy_fixed_segment_test.go @@ -57,6 +57,29 @@ func TestAccResourceNsxtPolicyFixedSegment_basicImport_multitenancy(t *testing.T }) } +func TestAccResourceNsxtPolicyFixedSegment_basicImport_multitenancyProvider(t *testing.T) { + name := getAccTestResourceName() + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t); testAccOnlyMultitenancyProvider(t) }, + Providers: testAccProviders, + CheckDestroy: func(state *terraform.State) error { + return testAccNsxtPolicyFixedSegmentCheckDestroy(state, name) + }, + Steps: []resource.TestStep{ + { + Config: testAccNsxtPolicyFixedSegmentImportTemplate("", name, false), + }, + { + ResourceName: testAccPolicyFixedSegmentResourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateIdFunc: testAccResourceNsxtPolicyImportIDRetriever(testAccPolicyFixedSegmentResourceName), + }, + }, + }) +} + func TestAccResourceNsxtPolicyFixedSegment_basicUpdate(t *testing.T) { testAccResourceNsxtPolicyFixedSegmentBasicUpdate(t, false, func() { testAccPreCheck(t) @@ -70,6 +93,13 @@ func TestAccResourceNsxtPolicyFixedSegment_multitenancy(t *testing.T) { }) } +func TestAccResourceNsxtPolicyFixedSegment_multitenancyProvider(t *testing.T) { + testAccResourceNsxtPolicyFixedSegmentBasicUpdate(t, false, func() { + testAccPreCheck(t) + testAccOnlyMultitenancyProvider(t) + }) +} + func testAccResourceNsxtPolicyFixedSegmentBasicUpdate(t *testing.T, withContext bool, preCheck func()) { name := getAccTestResourceName() updatedName := getAccTestResourceName() diff --git a/nsxt/resource_nsxt_policy_gateway_dns_forwarder_test.go b/nsxt/resource_nsxt_policy_gateway_dns_forwarder_test.go index e2a1259c1..46ea8cfed 100644 --- a/nsxt/resource_nsxt_policy_gateway_dns_forwarder_test.go +++ b/nsxt/resource_nsxt_policy_gateway_dns_forwarder_test.go @@ -57,6 +57,13 @@ func TestAccResourceNsxtPolicyGatewayDNSForwarder_tier1_multitenancy(t *testing. }) } +func TestAccResourceNsxtPolicyGatewayDNSForwarder_tier1_multitenancyProvider(t *testing.T) { + testAccResourceNsxtPolicyGatewayDNSForwarder(t, false, false, func() { + testAccPreCheck(t) + testAccOnlyMultitenancyProvider(t) + }) +} + func testAccResourceNsxtPolicyGatewayDNSForwarder(t *testing.T, isT0 bool, withContext bool, preCheck func()) { resourceName := testAccResourcePolicyGatewayDNSForwarderName resource.Test(t, resource.TestCase{ @@ -156,6 +163,27 @@ func TestAccResourceNsxtPolicyGatewayDNSForwarder_importTier1_multitenancy(t *te }) } +func TestAccResourceNsxtPolicyGatewayDNSForwarder_importTier1_multitenancyProvider(t *testing.T) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t); testAccOnlyMultitenancyProvider(t) }, + Providers: testAccProviders, + CheckDestroy: func(state *terraform.State) error { + return testAccNsxtPolicyGatewayDNSForwarderCheckDestroy(state, accTestPolicyGatewayDNSForwarderCreateAttributes["display_name"]) + }, + Steps: []resource.TestStep{ + { + Config: testAccNsxtPolicyGatewayDNSForwarderMinimalistic(false, false), + }, + { + ResourceName: testAccResourcePolicyGatewayDNSForwarderName, + ImportState: true, + ImportStateVerify: true, + ImportStateIdFunc: testAccNSXPolicyGatewayDNSForwarderImporterGetID, + }, + }, + }) +} + func testAccNSXPolicyGatewayDNSForwarderImporterGetID(s *terraform.State) (string, error) { rs, ok := s.RootModule().Resources[testAccResourcePolicyGatewayDNSForwarderName] if !ok { diff --git a/nsxt/resource_nsxt_policy_gateway_flood_protection_profile_binding_test.go b/nsxt/resource_nsxt_policy_gateway_flood_protection_profile_binding_test.go index 35d41a1f6..64e6c3cd9 100644 --- a/nsxt/resource_nsxt_policy_gateway_flood_protection_profile_binding_test.go +++ b/nsxt/resource_nsxt_policy_gateway_flood_protection_profile_binding_test.go @@ -74,6 +74,13 @@ func TestAccResourceNsxtPolicyT1GatewayFloodProtectionProfileBinding_multitenanc }, "tier1") } +func TestAccResourceNsxtPolicyT1GatewayFloodProtectionProfileBinding_multitenancyProvider(t *testing.T) { + testAccResourceNsxtPolicyGatewayFloodProtectionProfileBindingBasic(t, false, func() { + testAccPreCheck(t) + testAccOnlyMultitenancyProvider(t) + }, "tier1") +} + func testAccResourceNsxtPolicyGatewayFloodProtectionProfileBindingBasic(t *testing.T, withContext bool, preCheck func(), parent string) { testResourceName := "nsxt_policy_gateway_flood_protection_profile_binding.test" if withContext { @@ -134,6 +141,13 @@ func TestAccResourceNsxtPolicyGatewayFloodProtectionProfileBinding_importBasic_m }, "tier1") } +func TestAccResourceNsxtPolicyGatewayFloodProtectionProfileBinding_importBasic_multitenancyProvider(t *testing.T) { + testAccResourceNsxtPolicyGatewayFloodProtectionProfileBindingImportBasic(t, false, func() { + testAccPreCheck(t) + testAccOnlyMultitenancyProvider(t) + }, "tier1") +} + func testAccResourceNsxtPolicyGatewayFloodProtectionProfileBindingImportBasic(t *testing.T, withContext bool, preCheck func(), parent string) { testResourceName := "nsxt_policy_gateway_flood_protection_profile_binding.test" if withContext { diff --git a/nsxt/resource_nsxt_policy_gateway_flood_protection_profile_test.go b/nsxt/resource_nsxt_policy_gateway_flood_protection_profile_test.go index c395d894c..60b5c06b3 100644 --- a/nsxt/resource_nsxt_policy_gateway_flood_protection_profile_test.go +++ b/nsxt/resource_nsxt_policy_gateway_flood_protection_profile_test.go @@ -68,6 +68,13 @@ func TestAccResourceNsxtPolicyGatewayFloodProtectionProfile_multitenancy(t *test }) } +func TestAccResourceNsxtPolicyGatewayFloodProtectionProfile_multitenancyProvider(t *testing.T) { + testAccResourceNsxtPolicyGatewayFloodProtectionProfileBasic(t, false, func() { + testAccPreCheck(t) + testAccOnlyMultitenancyProvider(t) + }) +} + func testAccResourceNsxtPolicyGatewayFloodProtectionProfileBasic(t *testing.T, withContext bool, preCheck func()) { testResourceName := "nsxt_policy_gateway_flood_protection_profile.test" if withContext { @@ -136,6 +143,13 @@ func TestAccResourceNsxtPolicyGatewayFloodProtectionProfile_importBasic_multiten }) } +func TestAccResourceNsxtPolicyGatewayFloodProtectionProfile_importBasic_multitenancyProvider(t *testing.T) { + testAccResourceNsxtPolicyGatewayFloodProtectionProfileImportBasic(t, false, func() { + testAccPreCheck(t) + testAccOnlyMultitenancyProvider(t) + }) +} + func testAccResourceNsxtPolicyGatewayFloodProtectionProfileImportBasic(t *testing.T, withContext bool, preCheck func()) { name := getAccTestResourceName() testResourceName := "nsxt_policy_gateway_flood_protection_profile.test" diff --git a/nsxt/resource_nsxt_policy_gateway_policy_test.go b/nsxt/resource_nsxt_policy_gateway_policy_test.go index 122b1832a..51931fbc5 100644 --- a/nsxt/resource_nsxt_policy_gateway_policy_test.go +++ b/nsxt/resource_nsxt_policy_gateway_policy_test.go @@ -24,6 +24,13 @@ func TestAccResourceNsxtPolicyGatewayPolicy_multitenancy(t *testing.T) { }) } +func TestAccResourceNsxtPolicyGatewayPolicy_multitenancyProvider(t *testing.T) { + testAccResourceNsxtPolicyGatewayPolicyBasic(t, false, func() { + testAccPreCheck(t) + testAccOnlyMultitenancyProvider(t) + }) +} + func testAccResourceNsxtPolicyGatewayPolicyBasic(t *testing.T, withContext bool, preCheck func()) { name := getAccTestResourceName() updatedName := getAccTestResourceName() @@ -253,6 +260,30 @@ func TestAccResourceNsxtPolicyGatewayPolicy_importBasic_multitenancy(t *testing. }) } +func TestAccResourceNsxtPolicyGatewayPolicy_importBasic_multitenancyProvider(t *testing.T) { + name := getAccTestResourceName() + testResourceName := "nsxt_policy_gateway_policy.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t); testAccOnlyMultitenancyProvider(t) }, + Providers: testAccProviders, + CheckDestroy: func(state *terraform.State) error { + return testAccNsxtPolicyGatewayPolicyCheckDestroy(state, name, defaultDomain) + }, + Steps: []resource.TestStep{ + { + Config: testAccNsxtPolicyGatewayPolicyBasic(name, "import", false), + }, + { + ResourceName: testResourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateIdFunc: testAccResourceNsxtPolicyImportIDRetriever(testResourceName), + }, + }, + }) +} + func TestAccResourceNsxtPolicyGatewayPolicy_importNoTcpStrict(t *testing.T) { name := getAccTestResourceName() testResourceName := "nsxt_policy_gateway_policy.test" diff --git a/nsxt/resource_nsxt_policy_group_test.go b/nsxt/resource_nsxt_policy_group_test.go index 469881b6a..29a2a7d19 100644 --- a/nsxt/resource_nsxt_policy_group_test.go +++ b/nsxt/resource_nsxt_policy_group_test.go @@ -56,6 +56,30 @@ func TestAccResourceNsxtPolicyGroup_basicImport_multitenancy(t *testing.T) { }) } +func TestAccResourceNsxtPolicyGroup_basicImport_multitenancyProvider(t *testing.T) { + name := getAccTestResourceName() + testResourceName := "nsxt_policy_group.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t); testAccOnlyMultitenancyProvider(t) }, + Providers: testAccProviders, + CheckDestroy: func(state *terraform.State) error { + return testAccNsxtPolicyGroupCheckDestroy(state, name, defaultDomain) + }, + Steps: []resource.TestStep{ + { + Config: testAccNsxtPolicyGroupIPAddressImportTemplate(name, false), + }, + { + ResourceName: testResourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateIdFunc: testAccResourceNsxtPolicyImportIDRetriever(testResourceName), + }, + }, + }) +} + func TestAccResourceNsxtPolicyGroup_addressCriteria(t *testing.T) { testAccResourceNsxtPolicyGroupAddressCriteria(t, false, func() { testAccPreCheck(t) @@ -69,6 +93,13 @@ func TestAccResourceNsxtPolicyGroup_addressCriteria_multitenancy(t *testing.T) { }) } +func TestAccResourceNsxtPolicyGroup_addressCriteria_multitenancyProvider(t *testing.T) { + testAccResourceNsxtPolicyGroupAddressCriteria(t, false, func() { + testAccPreCheck(t) + testAccOnlyMultitenancyProvider(t) + }) +} + func testAccResourceNsxtPolicyGroupAddressCriteria(t *testing.T, withContext bool, preCheck func()) { name := getAccTestResourceName() testResourceName := "nsxt_policy_group.test" diff --git a/nsxt/resource_nsxt_policy_intrusion_service_policy_test.go b/nsxt/resource_nsxt_policy_intrusion_service_policy_test.go index c9b6b2669..40906eb75 100644 --- a/nsxt/resource_nsxt_policy_intrusion_service_policy_test.go +++ b/nsxt/resource_nsxt_policy_intrusion_service_policy_test.go @@ -29,6 +29,13 @@ func TestAccResourceNsxtPolicyIntrusionServicePolicy_multitenancy(t *testing.T) }) } +func TestAccResourceNsxtPolicyIntrusionServicePolicy_multitenancyProvider(t *testing.T) { + testAccResourceNsxtPolicyIntrusionServicePolicyBasic(t, false, func() { + testAccPreCheck(t) + testAccOnlyMultitenancyProvider(t) + }) +} + func testAccResourceNsxtPolicyIntrusionServicePolicyBasic(t *testing.T, withContext bool, preCheck func()) { name := getAccTestResourceName() updatedName := getAccTestResourceName() @@ -219,6 +226,13 @@ func TestAccResourceNsxtPolicyIntrusionServicePolicy_importBasic_multitenancy(t }) } +func TestAccResourceNsxtPolicyIntrusionServicePolicy_importBasic_multitenancyProvider(t *testing.T) { + testAccResourceNsxtPolicyIntrusionServicePolicyImportBasic(t, false, func() { + testAccPreCheck(t) + testAccOnlyMultitenancyProvider(t) + }) +} + func testAccResourceNsxtPolicyIntrusionServicePolicyImportBasic(t *testing.T, withContext bool, preCheck func()) { name := getAccTestResourceName() testResourceName := "nsxt_policy_intrusion_service_policy.test" diff --git a/nsxt/resource_nsxt_policy_intrusion_service_profile_test.go b/nsxt/resource_nsxt_policy_intrusion_service_profile_test.go index 68a69debe..0385db770 100644 --- a/nsxt/resource_nsxt_policy_intrusion_service_profile_test.go +++ b/nsxt/resource_nsxt_policy_intrusion_service_profile_test.go @@ -26,6 +26,13 @@ func TestAccResourceNsxtPolicyIntrusionServiceProfile_multitenancy(t *testing.T) }) } +func TestAccResourceNsxtPolicyIntrusionServiceProfile_multitenancyProvider(t *testing.T) { + testAccResourceNsxtPolicyIntrusionServiceProfileBasic(t, false, func() { + testAccPreCheck(t) + testAccOnlyMultitenancyProvider(t) + }) +} + func testAccResourceNsxtPolicyIntrusionServiceProfileBasic(t *testing.T, withContext bool, preCheck func()) { name := getAccTestResourceName() updatedName := getAccTestResourceName() @@ -107,6 +114,13 @@ func TestAccResourceNsxtPolicyIntrusionServiceProfile_importBasic_multitenancy(t }) } +func TestAccResourceNsxtPolicyIntrusionServiceProfile_importBasic_multitenancyProvider(t *testing.T) { + testAccResourceNsxtPolicyIntrusionServiceProfileImportBasic(t, false, func() { + testAccPreCheck(t) + testAccOnlyMultitenancyProvider(t) + }) +} + func testAccResourceNsxtPolicyIntrusionServiceProfileImportBasic(t *testing.T, withContext bool, preCheck func()) { name := getAccTestResourceName() testResourceName := "nsxt_policy_intrusion_service_profile.test" diff --git a/nsxt/resource_nsxt_policy_ip_address_allocation_test.go b/nsxt/resource_nsxt_policy_ip_address_allocation_test.go index 5ee1611bb..e0cef4633 100644 --- a/nsxt/resource_nsxt_policy_ip_address_allocation_test.go +++ b/nsxt/resource_nsxt_policy_ip_address_allocation_test.go @@ -42,6 +42,13 @@ func TestAccResourceNsxtPolicyIPAddressAllocation_multitenancy(t *testing.T) { }) } +func TestAccResourceNsxtPolicyIPAddressAllocation_multitenancyProvider(t *testing.T) { + testAccResourceNsxtPolicyIPAddressAllocationBasic(t, false, func() { + testAccPreCheck(t) + testAccOnlyMultitenancyProvider(t) + }) +} + func testAccResourceNsxtPolicyIPAddressAllocationBasic(t *testing.T, withContext bool, preCheck func()) { testResourceName := "nsxt_policy_ip_address_allocation.test" @@ -191,6 +198,34 @@ func TestAccResourceNsxtPolicyIPAddressAllocation_importBasic_multitenancy(t *te }, }) } + +func TestAccResourceNsxtPolicyIPAddressAllocation_importBasic_multitenancyProvider(t *testing.T) { + name := accTestPolicyIPAddressAllocationUpdateAttributes["display_name"] + testResourceName := "nsxt_policy_ip_address_allocation.test" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t); testAccOnlyMultitenancyProvider(t) }, + Providers: testAccProviders, + CheckDestroy: func(state *terraform.State) error { + return testAccNsxtPolicyIPAddressAllocationCheckDestroy(state, name) + }, + Steps: []resource.TestStep{ + { + Config: testAccNsxtPolicyIPAddressAllocationTemplate(true, false), + }, + { + ResourceName: testResourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateIdFunc: testAccResourceNsxtPolicyImportIDRetriever(testResourceName), + }, + { + Config: testAccNsxtPolicyIPAddressAllocationDependenciesTemplate(true), + }, + }, + }) +} + func testAccNSXPolicyIPAddressAllocationImporterGetID(s *terraform.State) (string, error) { rs, ok := s.RootModule().Resources["nsxt_policy_ip_address_allocation.test"] if !ok { diff --git a/nsxt/resource_nsxt_policy_ip_block_test.go b/nsxt/resource_nsxt_policy_ip_block_test.go index 5de9285ba..1566efadf 100644 --- a/nsxt/resource_nsxt_policy_ip_block_test.go +++ b/nsxt/resource_nsxt_policy_ip_block_test.go @@ -63,6 +63,13 @@ func TestAccResourceNsxtPolicyIPBlock_multitenancy(t *testing.T) { }) } +func TestAccResourceNsxtPolicyIPBlock_multitenancyProvider(t *testing.T) { + testAccResourceNsxtPolicyIPBlockBasic(t, false, false, func() { + testAccPreCheck(t) + testAccOnlyMultitenancyProvider(t) + }) +} + func testAccResourceNsxtPolicyIPBlockBasic(t *testing.T, withContext bool, withVisibility bool, preCheck func()) { name := getAccTestResourceName() testResourceName := "nsxt_policy_ip_block.test" @@ -176,6 +183,30 @@ func TestAccResourceNsxtPolicyIPBlock_importBasic_multitenancy(t *testing.T) { }) } +func TestAccResourceNsxtPolicyIPBlock_importBasic_multitenancyProvider(t *testing.T) { + name := getAccTestResourceName() + testResourceName := "nsxt_policy_ip_block.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t); testAccOnlyMultitenancyProvider(t) }, + Providers: testAccProviders, + CheckDestroy: func(state *terraform.State) error { + return testAccNSXPolicyIPBlockCheckDestroy(state) + }, + Steps: []resource.TestStep{ + { + Config: testAccNSXPolicyIPBlockCreateMinimalTemplate(name, "192.191.1.0/24", false, false), + }, + { + ResourceName: testResourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateIdFunc: testAccResourceNsxtPolicyImportIDRetriever(testResourceName), + }, + }, + }) +} + func testAccNSXPolicyIPBlockCheckExists(resourceName string) resource.TestCheckFunc { return func(state *terraform.State) error { connector := getPolicyConnector(testAccProvider.Meta().(nsxtClients)) diff --git a/nsxt/resource_nsxt_policy_ip_discovery_profile_test.go b/nsxt/resource_nsxt_policy_ip_discovery_profile_test.go index deb428013..a34dcef20 100644 --- a/nsxt/resource_nsxt_policy_ip_discovery_profile_test.go +++ b/nsxt/resource_nsxt_policy_ip_discovery_profile_test.go @@ -56,6 +56,13 @@ func TestAccResourceNsxtPolicyIPDiscoveryProfile_multitenancy(t *testing.T) { }) } +func TestAccResourceNsxtPolicyIPDiscoveryProfile_multitenancyProvider(t *testing.T) { + testAccResourceNsxtPolicyIPDiscoveryProfileBasic(t, false, func() { + testAccPreCheck(t) + testAccOnlyMultitenancyProvider(t) + }) +} + func testAccResourceNsxtPolicyIPDiscoveryProfileBasic(t *testing.T, withContext bool, preCheck func()) { testResourceName := "nsxt_policy_ip_discovery_profile.test" @@ -187,6 +194,30 @@ func TestAccResourceNsxtPolicyIPDiscoveryProfile_importBasic_multitenancy(t *tes }) } +func TestAccResourceNsxtPolicyIPDiscoveryProfile_importBasic_multitenancyProvider(t *testing.T) { + name := getAccTestResourceName() + testResourceName := "nsxt_policy_ip_discovery_profile.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t); testAccOnlyMultitenancyProvider(t) }, + Providers: testAccProviders, + CheckDestroy: func(state *terraform.State) error { + return testAccNsxtPolicyIPDiscoveryProfileCheckDestroy(state, name) + }, + Steps: []resource.TestStep{ + { + Config: testAccNsxtPolicyIPDiscoveryProfileMinimalistic(false), + }, + { + ResourceName: testResourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateIdFunc: testAccResourceNsxtPolicyImportIDRetriever(testResourceName), + }, + }, + }) +} + func testAccNsxtPolicyIPDiscoveryProfileExists(displayName string, resourceName string) resource.TestCheckFunc { return func(state *terraform.State) error { diff --git a/nsxt/resource_nsxt_policy_ip_pool_block_subnet_test.go b/nsxt/resource_nsxt_policy_ip_pool_block_subnet_test.go index 4a22ce152..03308c9af 100644 --- a/nsxt/resource_nsxt_policy_ip_pool_block_subnet_test.go +++ b/nsxt/resource_nsxt_policy_ip_pool_block_subnet_test.go @@ -62,6 +62,13 @@ func TestAccResourceNsxtPolicyIPPoolBlockSubnet_multitenancy(t *testing.T) { }) } +func TestAccResourceNsxtPolicyIPPoolBlockSubnet_multitenancyProvider(t *testing.T) { + testAccResourceNsxtPolicyIPPoolBlockSubnetBasic(t, false, func() { + testAccPreCheck(t) + testAccOnlyMultitenancyProvider(t) + }) +} + func testAccResourceNsxtPolicyIPPoolBlockSubnetBasic(t *testing.T, withContext bool, preCheck func()) { poolName := getAccTestResourceName() name := getAccTestResourceName() @@ -170,6 +177,34 @@ func TestAccResourceNsxtPolicyIPPoolBlockSubnet_importBasic_multitenancy(t *test }) } +func TestAccResourceNsxtPolicyIPPoolBlockSubnet_importBasic_multitenancyProvider(t *testing.T) { + poolName := getAccTestResourceName() + name := getAccTestResourceName() + testResourceName := "nsxt_policy_ip_pool_block_subnet.test" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t); testAccOnlyMultitenancyProvider(t) }, + Providers: testAccProviders, + CheckDestroy: func(state *terraform.State) error { + return testAccNSXPolicyIPPoolBlockSubnetCheckDestroy(state) + }, + Steps: []resource.TestStep{ + { + Config: testAccNSXPolicyIPPoolBlockSubnetCreateTemplate(poolName, name, false), + }, + { + ResourceName: testResourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateIdFunc: testAccResourceNsxtPolicyImportIDRetriever(testResourceName), + }, + { + Config: testAccNSXPolicyIPPoolBlockSubnetIPBlockTemplate(true), + }, + }, + }) +} + func testAccNSXPolicyIPPoolBlockSubnetImporterGetID(s *terraform.State) (string, error) { rs, ok := s.RootModule().Resources["nsxt_policy_ip_pool_block_subnet.test"] if !ok { diff --git a/nsxt/resource_nsxt_policy_ip_pool_static_subnet_test.go b/nsxt/resource_nsxt_policy_ip_pool_static_subnet_test.go index e2cf2082f..2cfb4bd38 100644 --- a/nsxt/resource_nsxt_policy_ip_pool_static_subnet_test.go +++ b/nsxt/resource_nsxt_policy_ip_pool_static_subnet_test.go @@ -59,6 +59,13 @@ func TestAccResourceNsxtPolicyIPPoolStaticSubnet_multitenancy(t *testing.T) { }) } +func TestAccResourceNsxtPolicyIPPoolStaticSubnet_multitenancyProvider(t *testing.T) { + testAccResourceNsxtPolicyIPPoolStaticSubnetBasic(t, false, func() { + testAccPreCheck(t) + testAccOnlyMultitenancyProvider(t) + }) +} + func testAccResourceNsxtPolicyIPPoolStaticSubnetBasic(t *testing.T, withContext bool, preCheck func()) { name := getAccTestResourceName() updatedName := getAccTestResourceName() @@ -174,6 +181,30 @@ func TestAccResourceNsxtPolicyIPPoolStaticSubnet_import_basic_multitenancy(t *te }) } +func TestAccResourceNsxtPolicyIPPoolStaticSubnet_import_basic_multitenancyProvider(t *testing.T) { + name := getAccTestResourceName() + testResourceName := "nsxt_policy_ip_pool_static_subnet.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t); testAccOnlyMultitenancyProvider(t) }, + Providers: testAccProviders, + CheckDestroy: func(state *terraform.State) error { + return testAccNSXPolicyIPPoolStaticSubnetCheckDestroy(state) + }, + Steps: []resource.TestStep{ + { + Config: testAccNSXPolicyIPPoolStaticSubnetCreateTemplate(name, false), + }, + { + ResourceName: testResourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateIdFunc: testAccResourceNsxtPolicyImportIDRetriever(testResourceName), + }, + }, + }) +} + func testAccNSXPolicyIPPoolStaticSubnetImporterGetID(s *terraform.State) (string, error) { rs, ok := s.RootModule().Resources["nsxt_policy_ip_pool_static_subnet.test"] if !ok { diff --git a/nsxt/resource_nsxt_policy_ip_pool_test.go b/nsxt/resource_nsxt_policy_ip_pool_test.go index fa027834b..2a5001253 100644 --- a/nsxt/resource_nsxt_policy_ip_pool_test.go +++ b/nsxt/resource_nsxt_policy_ip_pool_test.go @@ -51,6 +51,13 @@ func TestAccResourceNsxtPolicyIPPool_multitenancy(t *testing.T) { }) } +func TestAccResourceNsxtPolicyIPPool_multitenancyProvider(t *testing.T) { + testAccResourceNsxtPolicyIPPoolBasic(t, false, func() { + testAccPreCheck(t) + testAccOnlyMultitenancyProvider(t) + }) +} + func testAccResourceNsxtPolicyIPPoolBasic(t *testing.T, withContext bool, preCheck func()) { name := getAccTestResourceName() updatedName := getAccTestResourceName() @@ -134,6 +141,30 @@ func TestAccResourceNsxtPolicyIPPool_importBasic_multitenancy(t *testing.T) { }) } +func TestAccResourceNsxtPolicyIPPool_importBasic_multitenancyProvider(t *testing.T) { + name := getAccTestResourceName() + testResourceName := "nsxt_policy_ip_pool.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t); testAccOnlyMultitenancyProvider(t) }, + Providers: testAccProviders, + CheckDestroy: func(state *terraform.State) error { + return testAccNSXPolicyIPPoolCheckDestroy(state) + }, + Steps: []resource.TestStep{ + { + Config: testAccNSXPolicyIPPoolCreateTemplate(name, false), + }, + { + ResourceName: testResourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateIdFunc: testAccResourceNsxtPolicyImportIDRetriever(testResourceName), + }, + }, + }) +} + func testAccNSXPolicyIPPoolCheckExists(resourceName string) resource.TestCheckFunc { return func(state *terraform.State) error { connector := getPolicyConnector(testAccProvider.Meta().(nsxtClients)) diff --git a/nsxt/resource_nsxt_policy_mac_discovery_profile_test.go b/nsxt/resource_nsxt_policy_mac_discovery_profile_test.go index 2c38234c6..306ee582f 100644 --- a/nsxt/resource_nsxt_policy_mac_discovery_profile_test.go +++ b/nsxt/resource_nsxt_policy_mac_discovery_profile_test.go @@ -34,6 +34,14 @@ func TestAccResourceNsxtPolicyMacDiscoveryProfile_multitenancy(t *testing.T) { }) } +func TestAccResourceNsxtPolicyMacDiscoveryProfile_multitenancyProvider(t *testing.T) { + testAccResourceNsxtPolicyMacDiscoveryProfileBasic(t, false, func() { + testAccPreCheck(t) + testAccNSXVersion(t, "3.0.0") + testAccOnlyMultitenancyProvider(t) + }) +} + func getMacDiscoveryProfileTestCheckFunc(testResourceName string, create bool) []resource.TestCheckFunc { displayName := createDisplayName if !create { @@ -170,6 +178,30 @@ func TestAccResourceNsxtPolicyMacDiscoveryProfile_importBasic_multitenancy(t *te }) } +func TestAccResourceNsxtPolicyMacDiscoveryProfile_importBasic_multitenancyProvider(t *testing.T) { + name := getAccTestResourceName() + testResourceName := "nsxt_policy_mac_discovery_profile.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t); testAccOnlyMultitenancyProvider(t) }, + Providers: testAccProviders, + CheckDestroy: func(state *terraform.State) error { + return testAccNsxtPolicyMacDiscoveryProfileCheckDestroy(state, name) + }, + Steps: []resource.TestStep{ + { + Config: testAccNsxtPolicyMacDiscoveryProfileMinimalistic(false), + }, + { + ResourceName: testResourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateIdFunc: testAccResourceNsxtPolicyImportIDRetriever(testResourceName), + }, + }, + }) +} + func testAccNsxtPolicyMacDiscoveryProfileExists(displayName string, resourceName string) resource.TestCheckFunc { return func(state *terraform.State) error { diff --git a/nsxt/resource_nsxt_policy_nat_rule_test.go b/nsxt/resource_nsxt_policy_nat_rule_test.go index a2ef6e5e7..f00f818ac 100644 --- a/nsxt/resource_nsxt_policy_nat_rule_test.go +++ b/nsxt/resource_nsxt_policy_nat_rule_test.go @@ -61,6 +61,13 @@ func TestAccResourceNsxtPolicyNATRule_basicT1_multitenancy(t *testing.T) { }) } +func TestAccResourceNsxtPolicyNATRule_basicT1_multitenancyProvider(t *testing.T) { + testAccResourceNsxtPolicyNATRuleBasicT1(t, false, func() { + testAccPreCheck(t) + testAccOnlyMultitenancyProvider(t) + }) +} + func testAccResourceNsxtPolicyNATRuleBasicT1(t *testing.T, withContext bool, preCheck func()) { name := getAccTestResourceName() updateName := getAccTestResourceName() @@ -306,6 +313,30 @@ func TestAccResourceNsxtPolicyNATRule_basicT1Import_multitenancy(t *testing.T) { }) } +func TestAccResourceNsxtPolicyNATRule_basicT1Import_multitenancyProvider(t *testing.T) { + name := getAccTestResourceName() + action := model.PolicyNatRule_ACTION_DNAT + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t); testAccOnlyMultitenancyProvider(t) }, + Providers: testAccProviders, + CheckDestroy: func(state *terraform.State) error { + return testAccNsxtPolicyNATRuleCheckDestroy(state, name, false) + }, + Steps: []resource.TestStep{ + { + Config: testAccNsxtPolicyNATRuleTier1CreateTemplate(name, action, testAccResourcePolicyNATRuleSourceNet, testAccResourcePolicyNATRuleDestNet, testAccResourcePolicyNATRuleTransNet, false), + }, + { + ResourceName: testAccResourcePolicyNATRuleName, + ImportState: true, + ImportStateVerify: true, + ImportStateIdFunc: testAccResourceNsxtPolicyImportIDRetriever(testAccResourcePolicyNATRuleName), + }, + }, + }) +} + func TestAccResourceNsxtPolicyNATRule_nat64T1(t *testing.T) { name := getAccTestResourceName() updateName := getAccTestResourceName() diff --git a/nsxt/resource_nsxt_policy_parent_security_policy_test.go b/nsxt/resource_nsxt_policy_parent_security_policy_test.go index c7f732de6..2f013824e 100644 --- a/nsxt/resource_nsxt_policy_parent_security_policy_test.go +++ b/nsxt/resource_nsxt_policy_parent_security_policy_test.go @@ -24,6 +24,13 @@ func TestAccResourceNsxtPolicyParentSecurityPolicy_multitenancy(t *testing.T) { }) } +func TestAccResourceNsxtPolicyParentSecurityPolicy_multitenancyProvider(t *testing.T) { + testAccResourceNsxtPolicyParentSecurityPolicyBasic(t, false, func() { + testAccPreCheck(t) + testAccOnlyMultitenancyProvider(t) + }) +} + func testAccResourceNsxtPolicyParentSecurityPolicyBasic(t *testing.T, withContext bool, preCheck func()) { testResourceName := "nsxt_policy_parent_security_policy.test" @@ -118,6 +125,33 @@ func TestAccResourceNsxtPolicyParentSecurityPolicy_importBasic_multitenancy(t *t }) } +func TestAccResourceNsxtPolicyParentSecurityPolicy_importBasic_multitenancyProvider(t *testing.T) { + name := getAccTestResourceName() + testResourceName := "nsxt_policy_parent_security_policy.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { + testAccPreCheck(t) + testAccOnlyMultitenancyProvider(t) + }, + Providers: testAccProviders, + CheckDestroy: func(state *terraform.State) error { + return testAccNsxtPolicySecurityPolicyCheckDestroy(state, name, defaultDomain) + }, + Steps: []resource.TestStep{ + { + Config: testAccNsxtPolicyParentSecurityPolicyTemplate(false, name, "true", "1", "true"), + }, + { + ResourceName: testResourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateIdFunc: testAccResourceNsxtPolicyImportIDRetriever(testResourceName), + }, + }, + }) +} + func testAccNsxtPolicyParentSecurityPolicyCheckDestroy(state *terraform.State, displayName string) error { connector := getPolicyConnector(testAccProvider.Meta().(nsxtClients)) for _, rs := range state.RootModule().Resources { diff --git a/nsxt/resource_nsxt_policy_predefined_security_policy_test.go b/nsxt/resource_nsxt_policy_predefined_security_policy_test.go index a3226bbd5..533395dbf 100644 --- a/nsxt/resource_nsxt_policy_predefined_security_policy_test.go +++ b/nsxt/resource_nsxt_policy_predefined_security_policy_test.go @@ -25,6 +25,13 @@ func TestAccResourceNsxtPolicyPredefinedSecurityPolicy_multitenancy(t *testing.T }) } +func TestAccResourceNsxtPolicyPredefinedSecurityPolicy_multitenancyProvider(t *testing.T) { + testAccResourceNsxtPolicyPredefinedSecurityPolicyBasic(t, false, func() { + testAccPreCheck(t) + testAccOnlyMultitenancyProvider(t) + }) +} + func testAccResourceNsxtPolicyPredefinedSecurityPolicyBasic(t *testing.T, withContext bool, preCheck func()) { testResourceName := "nsxt_policy_predefined_security_policy.test" description1 := "test 1" diff --git a/nsxt/resource_nsxt_policy_qos_profile_test.go b/nsxt/resource_nsxt_policy_qos_profile_test.go index 43533278a..01b8cc348 100644 --- a/nsxt/resource_nsxt_policy_qos_profile_test.go +++ b/nsxt/resource_nsxt_policy_qos_profile_test.go @@ -24,6 +24,13 @@ func TestAccResourceNsxtPolicyQosProfile_multitenancy(t *testing.T) { }) } +func TestAccResourceNsxtPolicyQosProfile_multitenancyProvider(t *testing.T) { + testAccResourceNsxtPolicyQosProfileBasic(t, false, func() { + testAccPreCheck(t) + testAccOnlyMultitenancyProvider(t) + }) +} + func testAccResourceNsxtPolicyQosProfileBasic(t *testing.T, withContext bool, preCheck func()) { name := getAccTestResourceName() updatedName := getAccTestResourceName() @@ -158,6 +165,29 @@ func TestAccResourceNsxtPolicyQosProfile_importBasic_multitenancy(t *testing.T) }) } +func TestAccResourceNsxtPolicyQosProfile_importBasic_multitenancyProvider(t *testing.T) { + name := getAccTestResourceName() + testResourceName := "nsxt_policy_qos_profile.test" + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t); testAccOnlyMultitenancyProvider(t) }, + Providers: testAccProviders, + CheckDestroy: func(state *terraform.State) error { + return testAccNSXPolicyQosProfileCheckDestroy(state, name) + }, + Steps: []resource.TestStep{ + { + Config: testAccNSXPolicyQosProfileCreateTemplateTrivial(name, false), + }, + { + ResourceName: testResourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateIdFunc: testAccResourceNsxtPolicyImportIDRetriever(testResourceName), + }, + }, + }) +} + func testAccNSXPolicyQosProfileExists(displayName string, resourceName string) resource.TestCheckFunc { return func(state *terraform.State) error { connector := getPolicyConnector(testAccProvider.Meta().(nsxtClients))