// Code generated by "gen/generator.go"; DO NOT EDIT.
// In order to regenerate this file execute `go generate` from the repository root.
// More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md).

package provider

import (
	"regexp"
	"testing"

	"github.com/hashicorp/terraform-plugin-testing/helper/resource"
	"github.com/hashicorp/terraform-plugin-testing/knownvalue"
	"github.com/hashicorp/terraform-plugin-testing/statecheck"
	"github.com/hashicorp/terraform-plugin-testing/tfjsonpath"
)

func TestAccResourceNetflowExporterPolWithFvTenant(t *testing.T) {

	resource.Test(t, resource.TestCase{
		PreCheck:                 func() { testAccPreCheck(t, "both", "2.2(1k)-") },
		ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
		Steps: []resource.TestStep{
			// Create with minimum config and verify default APIC values
			{
				Config:             testConfigNetflowExporterPolMinDependencyWithFvTenantAllowExisting,
				ExpectNonEmptyPlan: false,
				Check: resource.ComposeAggregateTestCheckFunc(
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.allow_test", "name", "netfow_exporter"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.allow_test_2", "name", "netfow_exporter"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.allow_test", "annotation", "orchestrator:terraform"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.allow_test_2", "annotation", "orchestrator:terraform"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.allow_test", "description", ""),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.allow_test_2", "description", ""),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.allow_test", "destination_ip_address", "2.2.2.1"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.allow_test_2", "destination_ip_address", "2.2.2.1"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.allow_test", "destination_port", "https"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.allow_test_2", "destination_port", "https"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.allow_test", "name_alias", ""),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.allow_test_2", "name_alias", ""),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.allow_test", "owner_key", ""),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.allow_test_2", "owner_key", ""),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.allow_test", "owner_tag", ""),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.allow_test_2", "owner_tag", ""),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.allow_test", "qos_dscp_value", "CS2"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.allow_test_2", "qos_dscp_value", "CS2"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.allow_test", "source_ip_address", "1.1.1.1/10"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.allow_test_2", "source_ip_address", "1.1.1.1/10"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.allow_test", "source_ip_type", "custom-src-ip"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.allow_test_2", "source_ip_type", "custom-src-ip"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.allow_test", "version", "v9"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.allow_test_2", "version", "v9"),
				),
			},
		},
	})

	setEnvVariable(t, "ACI_ALLOW_EXISTING_ON_CREATE", "false")
	resource.Test(t, resource.TestCase{
		PreCheck:                 func() { testAccPreCheck(t, "both", "2.2(1k)-") },
		ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
		Steps: []resource.TestStep{
			// Create with minimum config and verify default APIC values
			{
				Config:      testConfigNetflowExporterPolMinDependencyWithFvTenantAllowExisting,
				ExpectError: regexp.MustCompile("Object Already Exists"),
			},
		},
	})

	setEnvVariable(t, "ACI_ALLOW_EXISTING_ON_CREATE", "true")
	resource.Test(t, resource.TestCase{
		PreCheck:                 func() { testAccPreCheck(t, "both", "2.2(1k)-") },
		ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
		Steps: []resource.TestStep{
			// Create with minimum config and verify default APIC values
			{
				Config:             testConfigNetflowExporterPolMinDependencyWithFvTenantAllowExisting,
				ExpectNonEmptyPlan: false,
				Check: resource.ComposeAggregateTestCheckFunc(
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.allow_test", "name", "netfow_exporter"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.allow_test_2", "name", "netfow_exporter"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.allow_test", "annotation", "orchestrator:terraform"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.allow_test_2", "annotation", "orchestrator:terraform"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.allow_test", "description", ""),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.allow_test_2", "description", ""),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.allow_test", "destination_ip_address", "2.2.2.1"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.allow_test_2", "destination_ip_address", "2.2.2.1"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.allow_test", "destination_port", "https"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.allow_test_2", "destination_port", "https"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.allow_test", "name_alias", ""),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.allow_test_2", "name_alias", ""),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.allow_test", "owner_key", ""),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.allow_test_2", "owner_key", ""),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.allow_test", "owner_tag", ""),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.allow_test_2", "owner_tag", ""),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.allow_test", "qos_dscp_value", "CS2"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.allow_test_2", "qos_dscp_value", "CS2"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.allow_test", "source_ip_address", "1.1.1.1/10"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.allow_test_2", "source_ip_address", "1.1.1.1/10"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.allow_test", "source_ip_type", "custom-src-ip"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.allow_test_2", "source_ip_type", "custom-src-ip"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.allow_test", "version", "v9"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.allow_test_2", "version", "v9"),
				),
			},
		},
	})

	resource.Test(t, resource.TestCase{
		PreCheck:                 func() { testAccPreCheck(t, "both", "2.2(1k)-") },
		ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
		Steps: []resource.TestStep{
			// Create with minimum config and verify default APIC values
			{
				Config:             testConfigNetflowExporterPolMinDependencyWithFvTenant,
				ExpectNonEmptyPlan: false,
				Check: resource.ComposeAggregateTestCheckFunc(
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "name", "netfow_exporter"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "annotation", "orchestrator:terraform"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "description", ""),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "destination_ip_address", "2.2.2.1"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "destination_port", "https"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "name_alias", ""),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "owner_key", ""),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "owner_tag", ""),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "qos_dscp_value", "CS2"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "source_ip_address", "1.1.1.1/10"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "source_ip_type", "custom-src-ip"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "version", "v9"),
				),
			},
			// Update with all config and verify default APIC values
			{
				Config:             testConfigNetflowExporterPolAllDependencyWithFvTenant,
				ExpectNonEmptyPlan: false,
				Check: resource.ComposeAggregateTestCheckFunc(
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "name", "netfow_exporter"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "annotation", "annotation"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "description", "description_1"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "destination_ip_address", "12.12.12.1"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "destination_port", "ssh"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "name_alias", "name_alias_1"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "owner_key", "owner_key_1"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "owner_tag", "owner_tag_1"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "qos_dscp_value", "AF11"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "source_ip_address", "11.11.11.1/11"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "source_ip_type", "custom-src-ip"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "version", "v9"),
				),
			},
			// Update with minimum config and verify config is unchanged
			{
				Config:             testConfigNetflowExporterPolMinDependencyWithFvTenant,
				ExpectNonEmptyPlan: false,
				Check: resource.ComposeAggregateTestCheckFunc(
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "destination_ip_address", "2.2.2.1"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "destination_port", "https"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "name", "netfow_exporter"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "source_ip_address", "1.1.1.1/10"),
				),
			},
			// Update with empty strings config or default value
			{
				Config:             testConfigNetflowExporterPolResetDependencyWithFvTenant,
				ExpectNonEmptyPlan: false,
				Check: resource.ComposeAggregateTestCheckFunc(
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "destination_ip_address", "2.2.2.1"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "destination_port", "https"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "name", "netfow_exporter"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "source_ip_address", "1.1.1.1/10"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "annotation", "orchestrator:terraform"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "description", ""),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "name_alias", ""),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "owner_key", ""),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "owner_tag", ""),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "qos_dscp_value", "CS2"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "source_ip_type", "custom-src-ip"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "version", "v9"),
				),
			},
			// Import testing
			{
				ResourceName:      "aci_netflow_exporter_policy.test",
				ImportState:       true,
				ImportStateVerify: true,
			},
			// Update with children
			{
				Config:             testConfigNetflowExporterPolChildrenDependencyWithFvTenant,
				ExpectNonEmptyPlan: false,
				Check: resource.ComposeAggregateTestCheckFunc(
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "destination_ip_address", "2.2.2.1"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "destination_port", "https"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "name", "netfow_exporter"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "source_ip_address", "1.1.1.1/10"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "annotation", "orchestrator:terraform"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "description", ""),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "name_alias", ""),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "owner_key", ""),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "owner_tag", ""),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "qos_dscp_value", "CS2"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "source_ip_type", "custom-src-ip"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "version", "v9"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "annotations.0.key", "key_0"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "annotations.0.value", "value_1"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "annotations.1.key", "key_1"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "annotations.1.value", "test_value"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "relation_to_epg.annotation", "annotation_1"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "relation_to_epg.target_dn", "uni/tn-test_name/ap-test_name/epg-test_epg"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "relation_to_vrf.annotation", "annotation_1"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "relation_to_vrf.target_dn", "uni/tn-test_name/ctx-test_vrf"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "tags.0.key", "key_0"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "tags.0.value", "value_1"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "tags.1.key", "key_1"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "tags.1.value", "test_value"),
				),
			},
			// Refresh State before import testing to ensure that the state is up to date
			{
				RefreshState:       true,
				ExpectNonEmptyPlan: false,
			},
			// Import testing with children
			{
				ResourceName:      "aci_netflow_exporter_policy.test",
				ImportState:       true,
				ImportStateVerify: true,
			},
			// Update with children removed from config
			{
				Config:             testConfigNetflowExporterPolChildrenRemoveFromConfigDependencyWithFvTenant,
				ExpectNonEmptyPlan: false,
				Check: resource.ComposeAggregateTestCheckFunc(
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "annotations.0.key", "key_0"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "annotations.0.value", "value_1"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "annotations.1.key", "key_1"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "annotations.1.value", "test_value"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "annotations.#", "2"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "relation_to_epg.annotation", "annotation_1"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "relation_to_epg.annotations.0.key", "key_0"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "relation_to_epg.annotations.0.value", "value_1"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "relation_to_epg.annotations.1.key", "key_1"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "relation_to_epg.annotations.1.value", "test_value"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "annotations.#", "2"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "relation_to_epg.tags.0.key", "key_0"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "relation_to_epg.tags.0.value", "value_1"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "relation_to_epg.tags.1.key", "key_1"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "relation_to_epg.tags.1.value", "test_value"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "tags.#", "2"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "relation_to_epg.target_dn", "uni/tn-test_name/ap-test_name/epg-test_epg"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "relation_to_vrf.annotation", "annotation_1"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "relation_to_vrf.annotations.0.key", "key_0"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "relation_to_vrf.annotations.0.value", "value_1"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "relation_to_vrf.annotations.1.key", "key_1"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "relation_to_vrf.annotations.1.value", "test_value"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "annotations.#", "2"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "relation_to_vrf.tags.0.key", "key_0"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "relation_to_vrf.tags.0.value", "value_1"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "relation_to_vrf.tags.1.key", "key_1"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "relation_to_vrf.tags.1.value", "test_value"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "tags.#", "2"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "relation_to_vrf.target_dn", "uni/tn-test_name/ctx-test_vrf"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "tags.0.key", "key_0"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "tags.0.value", "value_1"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "tags.1.key", "key_1"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "tags.1.value", "test_value"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "tags.#", "2"),
				),
			},
			// Update with children first child removed
			{
				Config:             testConfigNetflowExporterPolChildrenRemoveOneDependencyWithFvTenant,
				ExpectNonEmptyPlan: false,
				Check: resource.ComposeAggregateTestCheckFunc(
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "annotations.0.key", "key_1"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "annotations.0.value", "test_value"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "annotations.#", "1"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "tags.0.key", "key_1"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "tags.0.value", "test_value"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "tags.#", "1"),
				),
				ConfigStateChecks: []statecheck.StateCheck{
					statecheck.ExpectKnownValue("aci_netflow_exporter_policy.test",
						tfjsonpath.New("relation_to_epg"),
						knownvalue.MapExact(
							map[string]knownvalue.Check{
								"annotation":  knownvalue.Null(),
								"annotations": knownvalue.Null(),
								"tags":        knownvalue.Null(),
								"target_dn":   knownvalue.Null(),
							},
						),
					),
					statecheck.ExpectKnownValue("aci_netflow_exporter_policy.test",
						tfjsonpath.New("relation_to_vrf"),
						knownvalue.MapExact(
							map[string]knownvalue.Check{
								"annotation":  knownvalue.Null(),
								"annotations": knownvalue.Null(),
								"tags":        knownvalue.Null(),
								"target_dn":   knownvalue.Null(),
							},
						),
					),
				},
			},
			// Update with all children removed
			{
				Config:             testConfigNetflowExporterPolChildrenRemoveAllDependencyWithFvTenant,
				ExpectNonEmptyPlan: false,
				Check: resource.ComposeAggregateTestCheckFunc(
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "annotations.#", "0"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "tags.#", "0"),
				),
				ConfigStateChecks: []statecheck.StateCheck{
					statecheck.ExpectKnownValue("aci_netflow_exporter_policy.test",
						tfjsonpath.New("relation_to_epg"),
						knownvalue.MapExact(
							map[string]knownvalue.Check{
								"annotation":  knownvalue.Null(),
								"annotations": knownvalue.Null(),
								"tags":        knownvalue.Null(),
								"target_dn":   knownvalue.Null(),
							},
						),
					),
					statecheck.ExpectKnownValue("aci_netflow_exporter_policy.test",
						tfjsonpath.New("relation_to_vrf"),
						knownvalue.MapExact(
							map[string]knownvalue.Check{
								"annotation":  knownvalue.Null(),
								"annotations": knownvalue.Null(),
								"tags":        knownvalue.Null(),
								"target_dn":   knownvalue.Null(),
							},
						),
					),
				},
			},
			// Update with minimum config and custom type semantic equivalent values
			{
				Config:             testConfigNetflowExporterPolCustomTypeDependencyWithFvTenant,
				ExpectNonEmptyPlan: false,
				Check: resource.ComposeAggregateTestCheckFunc(
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "destination_ip_address", "2.2.2.1"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "destination_port", "110"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "name", "netfow_exporter"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "qos_dscp_value", "0"),
					resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "source_ip_address", "1.1.1.1/10"),
				),
			},
		},
		CheckDestroy: testCheckResourceDestroy,
	})
}

const testChildDependencyConfigNetflowExporterPol = `
`

const testConfigNetflowExporterPolMinDependencyWithFvTenantAllowExisting = testConfigFvTenantMin + `
resource "aci_netflow_exporter_policy" "allow_test" {
  parent_dn = aci_tenant.test.id
  destination_ip_address = "2.2.2.1"
  destination_port = "https"
  name = "netfow_exporter"
  source_ip_address = "1.1.1.1/10"
}
resource "aci_netflow_exporter_policy" "allow_test_2" {
  parent_dn = aci_tenant.test.id
  destination_ip_address = "2.2.2.1"
  destination_port = "https"
  name = "netfow_exporter"
  source_ip_address = "1.1.1.1/10"
  depends_on = [aci_netflow_exporter_policy.allow_test]
}
`

const testConfigNetflowExporterPolMinDependencyWithFvTenant = testConfigFvTenantMin + `
resource "aci_netflow_exporter_policy" "test" {
  parent_dn = aci_tenant.test.id
  destination_ip_address = "2.2.2.1"
  destination_port = "https"
  name = "netfow_exporter"
  source_ip_address = "1.1.1.1/10"
}
`

const testConfigNetflowExporterPolAllDependencyWithFvTenant = testConfigFvTenantMin + `
resource "aci_netflow_exporter_policy" "test" {
  parent_dn = aci_tenant.test.id
  name = "netfow_exporter"
  annotation = "annotation"
  description = "description_1"
  destination_ip_address = "12.12.12.1"
  destination_port = "ssh"
  name_alias = "name_alias_1"
  owner_key = "owner_key_1"
  owner_tag = "owner_tag_1"
  qos_dscp_value = "AF11"
  source_ip_address = "11.11.11.1/11"
  source_ip_type = "custom-src-ip"
  version = "v9"
}
`

const testConfigNetflowExporterPolResetDependencyWithFvTenant = testConfigFvTenantMin + `
resource "aci_netflow_exporter_policy" "test" {
  parent_dn = aci_tenant.test.id
  name = "netfow_exporter"
  annotation = "orchestrator:terraform"
  description = ""
  destination_ip_address = "2.2.2.1"
  destination_port = "https"
  name_alias = ""
  owner_key = ""
  owner_tag = ""
  qos_dscp_value = "CS2"
  source_ip_address = "1.1.1.1/10"
  source_ip_type = "custom-src-ip"
  version = "v9"
}
`
const testConfigNetflowExporterPolChildrenDependencyWithFvTenant = testChildDependencyConfigNetflowExporterPol + testConfigFvTenantMin + `
resource "aci_netflow_exporter_policy" "test" {
  parent_dn = aci_tenant.test.id
  destination_ip_address = "2.2.2.1"
  destination_port = "https"
  name = "netfow_exporter"
  source_ip_address = "1.1.1.1/10"
  annotations = [
    {
      key = "key_0"
      value = "value_1"
    },
    {
      key = "key_1"
      value = "test_value"
    },
  ]
  relation_to_epg = {
    annotation = "annotation_1"
    annotations = [
	  {
        key = "key_0"
        value = "value_1"
	  },
	  {
        key = "key_1"
        value = "test_value"
	  },
    ]
    tags = [
	  {
        key = "key_0"
        value = "value_1"
	  },
	  {
        key = "key_1"
        value = "test_value"
	  },
    ]
    target_dn = "uni/tn-test_name/ap-test_name/epg-test_epg"
  }
  relation_to_vrf = {
    annotation = "annotation_1"
    annotations = [
	  {
        key = "key_0"
        value = "value_1"
	  },
	  {
        key = "key_1"
        value = "test_value"
	  },
    ]
    tags = [
	  {
        key = "key_0"
        value = "value_1"
	  },
	  {
        key = "key_1"
        value = "test_value"
	  },
    ]
    target_dn = "uni/tn-test_name/ctx-test_vrf"
  }
  tags = [
    {
      key = "key_0"
      value = "value_1"
    },
    {
      key = "key_1"
      value = "test_value"
    },
  ]
}
`

const testConfigNetflowExporterPolChildrenRemoveFromConfigDependencyWithFvTenant = testChildDependencyConfigNetflowExporterPol + testConfigFvTenantMin + `
resource "aci_netflow_exporter_policy" "test" {
  parent_dn = aci_tenant.test.id
  destination_ip_address = "2.2.2.1"
  destination_port = "https"
  name = "netfow_exporter"
  source_ip_address = "1.1.1.1/10"
}
`

const testConfigNetflowExporterPolChildrenRemoveOneDependencyWithFvTenant = testChildDependencyConfigNetflowExporterPol + testConfigFvTenantMin + `
resource "aci_netflow_exporter_policy" "test" {
  parent_dn = aci_tenant.test.id
  destination_ip_address = "2.2.2.1"
  destination_port = "https"
  name = "netfow_exporter"
  source_ip_address = "1.1.1.1/10"
  annotations = [ 
	{
	  key = "key_1"
	  value = "test_value"
	},
  ]
  relation_to_epg = {}
  relation_to_vrf = {}
  tags = [ 
	{
	  key = "key_1"
	  value = "test_value"
	},
  ]
}
`

const testConfigNetflowExporterPolChildrenRemoveAllDependencyWithFvTenant = testChildDependencyConfigNetflowExporterPol + testConfigFvTenantMin + `
resource "aci_netflow_exporter_policy" "test" {
  parent_dn = aci_tenant.test.id
  destination_ip_address = "2.2.2.1"
  destination_port = "https"
  name = "netfow_exporter"
  source_ip_address = "1.1.1.1/10"
  annotations = []
  relation_to_epg = {}
  relation_to_vrf = {}
  tags = []
}
`

const testConfigNetflowExporterPolCustomTypeDependencyWithFvTenant = testChildDependencyConfigNetflowExporterPol + testConfigFvTenantMin + `
resource "aci_netflow_exporter_policy" "test" {
  parent_dn = aci_tenant.test.id
  destination_ip_address = "2.2.2.1"
  destination_port = "110"
  name = "netfow_exporter"
  qos_dscp_value = "0"
  source_ip_address = "1.1.1.1/10"
}
`
