// 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 TestAccResourceFvCtxWithFvTenant(t *testing.T) {

	resource.Test(t, resource.TestCase{
		PreCheck:                 func() { testAccPreCheck(t, "both", "1.0(1e)-") },
		ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
		Steps: []resource.TestStep{
			// Create with minimum config and verify default APIC values
			{
				Config:             testConfigFvCtxMinDependencyWithFvTenantAllowExisting + testConfigDataSourceSystem,
				ExpectNonEmptyPlan: false,
				Check: resource.ComposeAggregateTestCheckFunc(
					resource.TestCheckResourceAttr("aci_vrf.allow_test", "name", "test_name"),
					resource.TestCheckResourceAttr("aci_vrf.allow_test_2", "name", "test_name"),
					resource.TestCheckResourceAttr("aci_vrf.allow_test", "annotation", "orchestrator:terraform"),
					resource.TestCheckResourceAttr("aci_vrf.allow_test_2", "annotation", "orchestrator:terraform"),
					resource.TestCheckResourceAttr("aci_vrf.allow_test", "bd_enforcement", "no"),
					resource.TestCheckResourceAttr("aci_vrf.allow_test_2", "bd_enforcement", "no"),
					resource.TestCheckResourceAttr("aci_vrf.allow_test", "description", ""),
					resource.TestCheckResourceAttr("aci_vrf.allow_test_2", "description", ""),
					resource.TestCheckResourceAttr("aci_vrf.allow_test", "name_alias", ""),
					resource.TestCheckResourceAttr("aci_vrf.allow_test_2", "name_alias", ""),
					resource.TestCheckResourceAttr("aci_vrf.allow_test", "owner_key", ""),
					resource.TestCheckResourceAttr("aci_vrf.allow_test_2", "owner_key", ""),
					resource.TestCheckResourceAttr("aci_vrf.allow_test", "owner_tag", ""),
					resource.TestCheckResourceAttr("aci_vrf.allow_test_2", "owner_tag", ""),
					resource.TestCheckResourceAttr("aci_vrf.allow_test", "policy_control_enforcement_direction", "ingress"),
					resource.TestCheckResourceAttr("aci_vrf.allow_test_2", "policy_control_enforcement_direction", "ingress"),
					resource.TestCheckResourceAttr("aci_vrf.allow_test", "policy_control_enforcement_mode", "enforced"),
					resource.TestCheckResourceAttr("aci_vrf.allow_test_2", "policy_control_enforcement_mode", "enforced"),
					composeAggregateTestCheckFuncWithVersion(t, "4.0(1h)-", "inside",
						resource.TestCheckResourceAttr("aci_vrf.allow_test", "ip_data_plane_learning", "enabled"),
						resource.TestCheckResourceAttr("aci_vrf.allow_test_2", "ip_data_plane_learning", "enabled")),
					resource.TestCheckResourceAttrSet("aci_vrf.allow_test", "pc_tag"),
					resource.TestCheckResourceAttrSet("aci_vrf.allow_test", "scope"),
				),
			},
		},
	})

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

	setEnvVariable(t, "ACI_ALLOW_EXISTING_ON_CREATE", "true")
	resource.Test(t, resource.TestCase{
		PreCheck:                 func() { testAccPreCheck(t, "both", "1.0(1e)-") },
		ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
		Steps: []resource.TestStep{
			// Create with minimum config and verify default APIC values
			{
				Config:             testConfigFvCtxMinDependencyWithFvTenantAllowExisting + testConfigDataSourceSystem,
				ExpectNonEmptyPlan: false,
				Check: resource.ComposeAggregateTestCheckFunc(
					resource.TestCheckResourceAttr("aci_vrf.allow_test", "name", "test_name"),
					resource.TestCheckResourceAttr("aci_vrf.allow_test_2", "name", "test_name"),
					resource.TestCheckResourceAttr("aci_vrf.allow_test", "annotation", "orchestrator:terraform"),
					resource.TestCheckResourceAttr("aci_vrf.allow_test_2", "annotation", "orchestrator:terraform"),
					resource.TestCheckResourceAttr("aci_vrf.allow_test", "bd_enforcement", "no"),
					resource.TestCheckResourceAttr("aci_vrf.allow_test_2", "bd_enforcement", "no"),
					resource.TestCheckResourceAttr("aci_vrf.allow_test", "description", ""),
					resource.TestCheckResourceAttr("aci_vrf.allow_test_2", "description", ""),
					resource.TestCheckResourceAttr("aci_vrf.allow_test", "name_alias", ""),
					resource.TestCheckResourceAttr("aci_vrf.allow_test_2", "name_alias", ""),
					resource.TestCheckResourceAttr("aci_vrf.allow_test", "owner_key", ""),
					resource.TestCheckResourceAttr("aci_vrf.allow_test_2", "owner_key", ""),
					resource.TestCheckResourceAttr("aci_vrf.allow_test", "owner_tag", ""),
					resource.TestCheckResourceAttr("aci_vrf.allow_test_2", "owner_tag", ""),
					resource.TestCheckResourceAttr("aci_vrf.allow_test", "policy_control_enforcement_direction", "ingress"),
					resource.TestCheckResourceAttr("aci_vrf.allow_test_2", "policy_control_enforcement_direction", "ingress"),
					resource.TestCheckResourceAttr("aci_vrf.allow_test", "policy_control_enforcement_mode", "enforced"),
					resource.TestCheckResourceAttr("aci_vrf.allow_test_2", "policy_control_enforcement_mode", "enforced"),
					composeAggregateTestCheckFuncWithVersion(t, "4.0(1h)-", "inside",
						resource.TestCheckResourceAttr("aci_vrf.allow_test", "ip_data_plane_learning", "enabled"),
						resource.TestCheckResourceAttr("aci_vrf.allow_test_2", "ip_data_plane_learning", "enabled")),
					resource.TestCheckResourceAttrSet("aci_vrf.allow_test", "pc_tag"),
					resource.TestCheckResourceAttrSet("aci_vrf.allow_test_2", "pc_tag"),
					resource.TestCheckResourceAttrSet("aci_vrf.allow_test", "scope"),
					resource.TestCheckResourceAttrSet("aci_vrf.allow_test_2", "scope"),
				),
			},
		},
	})

	resource.Test(t, resource.TestCase{
		PreCheck:                 func() { testAccPreCheck(t, "both", "1.0(1e)-") },
		ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
		Steps: []resource.TestStep{
			// Create with minimum config and verify default APIC values
			{
				Config:             testConfigFvCtxMinDependencyWithFvTenant + testConfigDataSourceSystem,
				ExpectNonEmptyPlan: false,
				Check: resource.ComposeAggregateTestCheckFunc(
					resource.TestCheckResourceAttr("aci_vrf.test", "name", "test_name"),
					resource.TestCheckResourceAttr("aci_vrf.test", "annotation", "orchestrator:terraform"),
					resource.TestCheckResourceAttr("aci_vrf.test", "bd_enforcement", "no"),
					resource.TestCheckResourceAttr("aci_vrf.test", "description", ""),
					resource.TestCheckResourceAttr("aci_vrf.test", "name_alias", ""),
					resource.TestCheckResourceAttr("aci_vrf.test", "owner_key", ""),
					resource.TestCheckResourceAttr("aci_vrf.test", "owner_tag", ""),
					resource.TestCheckResourceAttr("aci_vrf.test", "policy_control_enforcement_direction", "ingress"),
					resource.TestCheckResourceAttr("aci_vrf.test", "policy_control_enforcement_mode", "enforced"),
					composeAggregateTestCheckFuncWithVersion(t, "4.0(1h)-", "inside",
						resource.TestCheckResourceAttr("aci_vrf.test", "ip_data_plane_learning", "enabled")),
					resource.TestCheckResourceAttrSet("aci_vrf.test", "pc_tag"),
					resource.TestCheckResourceAttrSet("aci_vrf.test", "scope"),
				),
			},
			// Update with all config and verify default APIC values
			{
				Config:             testConfigFvCtxAllDependencyWithFvTenant + testConfigDataSourceSystem,
				ExpectNonEmptyPlan: false,
				Check: resource.ComposeAggregateTestCheckFunc(
					resource.TestCheckResourceAttr("aci_vrf.test", "name", "test_name"),
					resource.TestCheckResourceAttr("aci_vrf.test", "annotation", "annotation"),
					resource.TestCheckResourceAttr("aci_vrf.test", "bd_enforcement", "no"),
					resource.TestCheckResourceAttr("aci_vrf.test", "description", "description_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "name_alias", "name_alias_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "owner_key", "owner_key_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "owner_tag", "owner_tag_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "policy_control_enforcement_direction", "egress"),
					resource.TestCheckResourceAttr("aci_vrf.test", "policy_control_enforcement_mode", "enforced"),
					composeAggregateTestCheckFuncWithVersion(t, "4.0(1h)-", "inside",
						resource.TestCheckResourceAttr("aci_vrf.test", "ip_data_plane_learning", "disabled")),
					resource.TestCheckResourceAttrSet("aci_vrf.test", "pc_tag"),
					resource.TestCheckResourceAttrSet("aci_vrf.test", "scope"),
				),
			},
			// Update with minimum config and verify config is unchanged
			{
				Config:             testConfigFvCtxMinDependencyWithFvTenant + testConfigDataSourceSystem,
				ExpectNonEmptyPlan: false,
				Check: resource.ComposeAggregateTestCheckFunc(
					resource.TestCheckResourceAttr("aci_vrf.test", "name", "test_name"),
					resource.TestCheckResourceAttrSet("aci_vrf.test", "pc_tag"),
					resource.TestCheckResourceAttrSet("aci_vrf.test", "scope"),
				),
			},
			// Update with empty strings config or default value
			{
				Config:             testConfigFvCtxResetDependencyWithFvTenant + testConfigDataSourceSystem,
				ExpectNonEmptyPlan: false,
				Check: resource.ComposeAggregateTestCheckFunc(
					resource.TestCheckResourceAttr("aci_vrf.test", "name", "test_name"),
					resource.TestCheckResourceAttr("aci_vrf.test", "annotation", "orchestrator:terraform"),
					resource.TestCheckResourceAttr("aci_vrf.test", "bd_enforcement", "no"),
					resource.TestCheckResourceAttr("aci_vrf.test", "description", ""),
					resource.TestCheckResourceAttr("aci_vrf.test", "name_alias", ""),
					resource.TestCheckResourceAttr("aci_vrf.test", "owner_key", ""),
					resource.TestCheckResourceAttr("aci_vrf.test", "owner_tag", ""),
					resource.TestCheckResourceAttr("aci_vrf.test", "policy_control_enforcement_direction", "ingress"),
					resource.TestCheckResourceAttr("aci_vrf.test", "policy_control_enforcement_mode", "enforced"),
					composeAggregateTestCheckFuncWithVersion(t, "4.0(1h)-", "inside",
						resource.TestCheckResourceAttr("aci_vrf.test", "ip_data_plane_learning", "enabled")),
					resource.TestCheckResourceAttrSet("aci_vrf.test", "pc_tag"),
					resource.TestCheckResourceAttrSet("aci_vrf.test", "scope"),
				),
			},
			// Import testing
			{
				ResourceName:      "aci_vrf.test",
				ImportState:       true,
				ImportStateVerify: true,
			},
			// Update with children
			{
				Config:             testConfigFvCtxChildrenDependencyWithFvTenant + testConfigDataSourceSystem,
				ExpectNonEmptyPlan: false,
				Check: resource.ComposeAggregateTestCheckFunc(
					resource.TestCheckResourceAttr("aci_vrf.test", "name", "test_name"),
					resource.TestCheckResourceAttr("aci_vrf.test", "annotation", "orchestrator:terraform"),
					resource.TestCheckResourceAttr("aci_vrf.test", "bd_enforcement", "no"),
					resource.TestCheckResourceAttr("aci_vrf.test", "description", ""),
					resource.TestCheckResourceAttr("aci_vrf.test", "name_alias", ""),
					resource.TestCheckResourceAttr("aci_vrf.test", "owner_key", ""),
					resource.TestCheckResourceAttr("aci_vrf.test", "owner_tag", ""),
					resource.TestCheckResourceAttr("aci_vrf.test", "policy_control_enforcement_direction", "ingress"),
					resource.TestCheckResourceAttr("aci_vrf.test", "policy_control_enforcement_mode", "enforced"),
					composeAggregateTestCheckFuncWithVersion(t, "4.0(1h)-", "inside",
						resource.TestCheckResourceAttr("aci_vrf.test", "ip_data_plane_learning", "enabled")),
					resource.TestCheckResourceAttrSet("aci_vrf.test", "pc_tag"),
					resource.TestCheckResourceAttrSet("aci_vrf.test", "scope"),
					resource.TestCheckResourceAttr("aci_vrf.test", "annotations.0.key", "key_0"),
					resource.TestCheckResourceAttr("aci_vrf.test", "annotations.0.value", "value_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "annotations.1.key", "key_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "annotations.1.value", "test_value"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_address_family_ospf_timers.0.address_family", "ipv4-ucast"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_address_family_ospf_timers.0.annotation", "annotation_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_address_family_ospf_timers.0.ospf_timers_name", "ospf_timers_name_0"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_address_family_ospf_timers.1.address_family", "ipv6-ucast"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_address_family_ospf_timers.1.annotation", "annotation_2"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_address_family_ospf_timers.1.ospf_timers_name", "ospf_timers_name_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_bgp_address_family_contexts.0.address_family", "ipv4-ucast"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_bgp_address_family_contexts.0.annotation", "annotation_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_bgp_address_family_contexts.0.bgp_address_family_context_name", "bgp_address_family_context_name_0"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_bgp_address_family_contexts.1.address_family", "ipv6-ucast"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_bgp_address_family_contexts.1.annotation", "annotation_2"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_bgp_address_family_contexts.1.bgp_address_family_context_name", "bgp_address_family_context_name_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_bgp_timers.annotation", "annotation_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_bgp_timers.bgp_timers_name", "bgp_timers_name_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_eigrp_address_family_contexts.0.address_family", "ipv4-ucast"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_eigrp_address_family_contexts.0.annotation", "annotation_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_eigrp_address_family_contexts.0.eigrp_address_family_context_name", "eigrp_address_family_context_name_0"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_eigrp_address_family_contexts.1.address_family", "ipv6-ucast"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_eigrp_address_family_contexts.1.annotation", "annotation_2"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_eigrp_address_family_contexts.1.eigrp_address_family_context_name", "eigrp_address_family_context_name_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_end_point_retention_policy.annotation", "annotation_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_end_point_retention_policy.end_point_retention_policy_name", "end_point_retention_policy_name_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_l3out_route_tag_policy.annotation", "annotation_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_l3out_route_tag_policy.l3out_route_tag_policy_name", "l3out_route_tag_policy_name_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_monitoring_policy.annotation", "annotation_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_monitoring_policy.monitoring_policy_name", "monitoring_policy_name_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_ospf_timers.annotation", "annotation_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_ospf_timers.ospf_timers_name", "ospf_timers_name_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_wan_vpn.annotation", "annotation_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_wan_vpn.target_dn", "uni/tn-test_tenant/sdwanvpncont/sdwanvpnentry-sdwanvpn_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "tags.0.key", "key_0"),
					resource.TestCheckResourceAttr("aci_vrf.test", "tags.0.value", "value_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "tags.1.key", "key_1"),
					resource.TestCheckResourceAttr("aci_vrf.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_vrf.test",
				ImportState:       true,
				ImportStateVerify: true,
			},
			// Update with children removed from config
			{
				Config:             testConfigFvCtxChildrenRemoveFromConfigDependencyWithFvTenant + testConfigDataSourceSystem,
				ExpectNonEmptyPlan: false,
				Check: resource.ComposeAggregateTestCheckFunc(
					resource.TestCheckResourceAttrSet("aci_vrf.test", "pc_tag"),
					resource.TestCheckResourceAttrSet("aci_vrf.test", "scope"),
					resource.TestCheckResourceAttr("aci_vrf.test", "annotations.0.key", "key_0"),
					resource.TestCheckResourceAttr("aci_vrf.test", "annotations.0.value", "value_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "annotations.1.key", "key_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "annotations.1.value", "test_value"),
					resource.TestCheckResourceAttr("aci_vrf.test", "annotations.#", "2"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_address_family_ospf_timers.0.address_family", "ipv4-ucast"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_address_family_ospf_timers.0.annotation", "annotation_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_address_family_ospf_timers.0.annotations.0.key", "key_0"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_address_family_ospf_timers.0.annotations.0.value", "value_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_address_family_ospf_timers.0.annotations.1.key", "key_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_address_family_ospf_timers.0.annotations.1.value", "test_value"),
					resource.TestCheckResourceAttr("aci_vrf.test", "annotations.#", "2"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_address_family_ospf_timers.0.tags.0.key", "key_0"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_address_family_ospf_timers.0.tags.0.value", "value_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_address_family_ospf_timers.0.tags.1.key", "key_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_address_family_ospf_timers.0.tags.1.value", "test_value"),
					resource.TestCheckResourceAttr("aci_vrf.test", "tags.#", "2"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_address_family_ospf_timers.0.ospf_timers_name", "ospf_timers_name_0"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_address_family_ospf_timers.1.address_family", "ipv6-ucast"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_address_family_ospf_timers.1.annotation", "annotation_2"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_address_family_ospf_timers.1.annotations.0.key", "key_0"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_address_family_ospf_timers.1.annotations.0.value", "value_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_address_family_ospf_timers.1.annotations.1.key", "key_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_address_family_ospf_timers.1.annotations.1.value", "test_value"),
					resource.TestCheckResourceAttr("aci_vrf.test", "annotations.#", "2"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_address_family_ospf_timers.1.tags.0.key", "key_0"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_address_family_ospf_timers.1.tags.0.value", "value_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_address_family_ospf_timers.1.tags.1.key", "key_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_address_family_ospf_timers.1.tags.1.value", "test_value"),
					resource.TestCheckResourceAttr("aci_vrf.test", "tags.#", "2"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_address_family_ospf_timers.1.ospf_timers_name", "ospf_timers_name_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_address_family_ospf_timers.#", "2"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_bgp_address_family_contexts.0.address_family", "ipv4-ucast"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_bgp_address_family_contexts.0.annotation", "annotation_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_bgp_address_family_contexts.0.bgp_address_family_context_name", "bgp_address_family_context_name_0"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_bgp_address_family_contexts.0.annotations.0.key", "key_0"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_bgp_address_family_contexts.0.annotations.0.value", "value_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_bgp_address_family_contexts.0.annotations.1.key", "key_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_bgp_address_family_contexts.0.annotations.1.value", "test_value"),
					resource.TestCheckResourceAttr("aci_vrf.test", "annotations.#", "2"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_bgp_address_family_contexts.0.tags.0.key", "key_0"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_bgp_address_family_contexts.0.tags.0.value", "value_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_bgp_address_family_contexts.0.tags.1.key", "key_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_bgp_address_family_contexts.0.tags.1.value", "test_value"),
					resource.TestCheckResourceAttr("aci_vrf.test", "tags.#", "2"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_bgp_address_family_contexts.1.address_family", "ipv6-ucast"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_bgp_address_family_contexts.1.annotation", "annotation_2"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_bgp_address_family_contexts.1.bgp_address_family_context_name", "bgp_address_family_context_name_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_bgp_address_family_contexts.1.annotations.0.key", "key_0"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_bgp_address_family_contexts.1.annotations.0.value", "value_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_bgp_address_family_contexts.1.annotations.1.key", "key_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_bgp_address_family_contexts.1.annotations.1.value", "test_value"),
					resource.TestCheckResourceAttr("aci_vrf.test", "annotations.#", "2"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_bgp_address_family_contexts.1.tags.0.key", "key_0"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_bgp_address_family_contexts.1.tags.0.value", "value_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_bgp_address_family_contexts.1.tags.1.key", "key_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_bgp_address_family_contexts.1.tags.1.value", "test_value"),
					resource.TestCheckResourceAttr("aci_vrf.test", "tags.#", "2"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_bgp_address_family_contexts.#", "2"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_bgp_timers.annotation", "annotation_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_bgp_timers.bgp_timers_name", "bgp_timers_name_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_bgp_timers.annotations.0.key", "key_0"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_bgp_timers.annotations.0.value", "value_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_bgp_timers.annotations.1.key", "key_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_bgp_timers.annotations.1.value", "test_value"),
					resource.TestCheckResourceAttr("aci_vrf.test", "annotations.#", "2"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_bgp_timers.tags.0.key", "key_0"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_bgp_timers.tags.0.value", "value_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_bgp_timers.tags.1.key", "key_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_bgp_timers.tags.1.value", "test_value"),
					resource.TestCheckResourceAttr("aci_vrf.test", "tags.#", "2"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_eigrp_address_family_contexts.0.address_family", "ipv4-ucast"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_eigrp_address_family_contexts.0.annotation", "annotation_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_eigrp_address_family_contexts.0.annotations.0.key", "key_0"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_eigrp_address_family_contexts.0.annotations.0.value", "value_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_eigrp_address_family_contexts.0.annotations.1.key", "key_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_eigrp_address_family_contexts.0.annotations.1.value", "test_value"),
					resource.TestCheckResourceAttr("aci_vrf.test", "annotations.#", "2"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_eigrp_address_family_contexts.0.tags.0.key", "key_0"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_eigrp_address_family_contexts.0.tags.0.value", "value_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_eigrp_address_family_contexts.0.tags.1.key", "key_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_eigrp_address_family_contexts.0.tags.1.value", "test_value"),
					resource.TestCheckResourceAttr("aci_vrf.test", "tags.#", "2"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_eigrp_address_family_contexts.0.eigrp_address_family_context_name", "eigrp_address_family_context_name_0"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_eigrp_address_family_contexts.1.address_family", "ipv6-ucast"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_eigrp_address_family_contexts.1.annotation", "annotation_2"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_eigrp_address_family_contexts.1.annotations.0.key", "key_0"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_eigrp_address_family_contexts.1.annotations.0.value", "value_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_eigrp_address_family_contexts.1.annotations.1.key", "key_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_eigrp_address_family_contexts.1.annotations.1.value", "test_value"),
					resource.TestCheckResourceAttr("aci_vrf.test", "annotations.#", "2"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_eigrp_address_family_contexts.1.tags.0.key", "key_0"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_eigrp_address_family_contexts.1.tags.0.value", "value_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_eigrp_address_family_contexts.1.tags.1.key", "key_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_eigrp_address_family_contexts.1.tags.1.value", "test_value"),
					resource.TestCheckResourceAttr("aci_vrf.test", "tags.#", "2"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_eigrp_address_family_contexts.1.eigrp_address_family_context_name", "eigrp_address_family_context_name_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_eigrp_address_family_contexts.#", "2"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_end_point_retention_policy.annotation", "annotation_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_end_point_retention_policy.annotations.0.key", "key_0"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_end_point_retention_policy.annotations.0.value", "value_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_end_point_retention_policy.annotations.1.key", "key_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_end_point_retention_policy.annotations.1.value", "test_value"),
					resource.TestCheckResourceAttr("aci_vrf.test", "annotations.#", "2"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_end_point_retention_policy.tags.0.key", "key_0"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_end_point_retention_policy.tags.0.value", "value_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_end_point_retention_policy.tags.1.key", "key_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_end_point_retention_policy.tags.1.value", "test_value"),
					resource.TestCheckResourceAttr("aci_vrf.test", "tags.#", "2"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_end_point_retention_policy.end_point_retention_policy_name", "end_point_retention_policy_name_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_l3out_route_tag_policy.annotation", "annotation_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_l3out_route_tag_policy.annotations.0.key", "key_0"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_l3out_route_tag_policy.annotations.0.value", "value_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_l3out_route_tag_policy.annotations.1.key", "key_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_l3out_route_tag_policy.annotations.1.value", "test_value"),
					resource.TestCheckResourceAttr("aci_vrf.test", "annotations.#", "2"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_l3out_route_tag_policy.tags.0.key", "key_0"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_l3out_route_tag_policy.tags.0.value", "value_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_l3out_route_tag_policy.tags.1.key", "key_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_l3out_route_tag_policy.tags.1.value", "test_value"),
					resource.TestCheckResourceAttr("aci_vrf.test", "tags.#", "2"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_l3out_route_tag_policy.l3out_route_tag_policy_name", "l3out_route_tag_policy_name_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_monitoring_policy.annotation", "annotation_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_monitoring_policy.annotations.0.key", "key_0"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_monitoring_policy.annotations.0.value", "value_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_monitoring_policy.annotations.1.key", "key_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_monitoring_policy.annotations.1.value", "test_value"),
					resource.TestCheckResourceAttr("aci_vrf.test", "annotations.#", "2"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_monitoring_policy.tags.0.key", "key_0"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_monitoring_policy.tags.0.value", "value_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_monitoring_policy.tags.1.key", "key_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_monitoring_policy.tags.1.value", "test_value"),
					resource.TestCheckResourceAttr("aci_vrf.test", "tags.#", "2"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_monitoring_policy.monitoring_policy_name", "monitoring_policy_name_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_ospf_timers.annotation", "annotation_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_ospf_timers.annotations.0.key", "key_0"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_ospf_timers.annotations.0.value", "value_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_ospf_timers.annotations.1.key", "key_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_ospf_timers.annotations.1.value", "test_value"),
					resource.TestCheckResourceAttr("aci_vrf.test", "annotations.#", "2"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_ospf_timers.tags.0.key", "key_0"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_ospf_timers.tags.0.value", "value_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_ospf_timers.tags.1.key", "key_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_ospf_timers.tags.1.value", "test_value"),
					resource.TestCheckResourceAttr("aci_vrf.test", "tags.#", "2"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_ospf_timers.ospf_timers_name", "ospf_timers_name_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_wan_vpn.annotation", "annotation_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_wan_vpn.annotations.0.key", "key_0"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_wan_vpn.annotations.0.value", "value_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_wan_vpn.annotations.1.key", "key_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_wan_vpn.annotations.1.value", "test_value"),
					resource.TestCheckResourceAttr("aci_vrf.test", "annotations.#", "2"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_wan_vpn.tags.0.key", "key_0"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_wan_vpn.tags.0.value", "value_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_wan_vpn.tags.1.key", "key_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_wan_vpn.tags.1.value", "test_value"),
					resource.TestCheckResourceAttr("aci_vrf.test", "tags.#", "2"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_wan_vpn.target_dn", "uni/tn-test_tenant/sdwanvpncont/sdwanvpnentry-sdwanvpn_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "tags.0.key", "key_0"),
					resource.TestCheckResourceAttr("aci_vrf.test", "tags.0.value", "value_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "tags.1.key", "key_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "tags.1.value", "test_value"),
					resource.TestCheckResourceAttr("aci_vrf.test", "tags.#", "2"),
				),
			},
			// Update with children first child removed
			{
				Config:             testConfigFvCtxChildrenRemoveOneDependencyWithFvTenant + testConfigDataSourceSystem,
				ExpectNonEmptyPlan: false,
				Check: resource.ComposeAggregateTestCheckFunc(
					resource.TestCheckResourceAttrSet("aci_vrf.test", "pc_tag"),
					resource.TestCheckResourceAttrSet("aci_vrf.test", "scope"),
					resource.TestCheckResourceAttr("aci_vrf.test", "annotations.0.key", "key_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "annotations.0.value", "test_value"),
					resource.TestCheckResourceAttr("aci_vrf.test", "annotations.#", "1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_address_family_ospf_timers.0.address_family", "ipv6-ucast"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_address_family_ospf_timers.0.annotation", "annotation_2"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_address_family_ospf_timers.0.annotations.0.key", "key_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_address_family_ospf_timers.0.annotations.0.value", "test_value"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_address_family_ospf_timers.0.annotations.#", "1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_address_family_ospf_timers.0.tags.0.key", "key_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_address_family_ospf_timers.0.tags.0.value", "test_value"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_address_family_ospf_timers.0.tags.#", "1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_address_family_ospf_timers.0.ospf_timers_name", "ospf_timers_name_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_address_family_ospf_timers.#", "1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_bgp_address_family_contexts.0.address_family", "ipv6-ucast"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_bgp_address_family_contexts.0.annotation", "annotation_2"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_bgp_address_family_contexts.0.bgp_address_family_context_name", "bgp_address_family_context_name_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_bgp_address_family_contexts.0.annotations.0.key", "key_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_bgp_address_family_contexts.0.annotations.0.value", "test_value"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_bgp_address_family_contexts.0.annotations.#", "1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_bgp_address_family_contexts.0.tags.0.key", "key_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_bgp_address_family_contexts.0.tags.0.value", "test_value"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_bgp_address_family_contexts.0.tags.#", "1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_bgp_address_family_contexts.#", "1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_bgp_timers.annotation", "annotation_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_bgp_timers.bgp_timers_name", "bgp_timers_name_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_bgp_timers.annotations.0.key", "key_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_bgp_timers.annotations.0.value", "test_value"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_bgp_timers.annotations.#", "1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_bgp_timers.tags.0.key", "key_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_bgp_timers.tags.0.value", "test_value"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_bgp_timers.tags.#", "1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_eigrp_address_family_contexts.0.address_family", "ipv6-ucast"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_eigrp_address_family_contexts.0.annotation", "annotation_2"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_eigrp_address_family_contexts.0.annotations.0.key", "key_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_eigrp_address_family_contexts.0.annotations.0.value", "test_value"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_eigrp_address_family_contexts.0.annotations.#", "1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_eigrp_address_family_contexts.0.tags.0.key", "key_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_eigrp_address_family_contexts.0.tags.0.value", "test_value"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_eigrp_address_family_contexts.0.tags.#", "1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_eigrp_address_family_contexts.0.eigrp_address_family_context_name", "eigrp_address_family_context_name_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_eigrp_address_family_contexts.#", "1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_end_point_retention_policy.annotation", "annotation_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_end_point_retention_policy.annotations.0.key", "key_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_end_point_retention_policy.annotations.0.value", "test_value"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_end_point_retention_policy.annotations.#", "1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_end_point_retention_policy.tags.0.key", "key_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_end_point_retention_policy.tags.0.value", "test_value"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_end_point_retention_policy.tags.#", "1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_end_point_retention_policy.end_point_retention_policy_name", "end_point_retention_policy_name_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_l3out_route_tag_policy.annotation", "annotation_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_l3out_route_tag_policy.annotations.0.key", "key_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_l3out_route_tag_policy.annotations.0.value", "test_value"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_l3out_route_tag_policy.annotations.#", "1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_l3out_route_tag_policy.tags.0.key", "key_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_l3out_route_tag_policy.tags.0.value", "test_value"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_l3out_route_tag_policy.tags.#", "1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_l3out_route_tag_policy.l3out_route_tag_policy_name", "l3out_route_tag_policy_name_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_ospf_timers.annotation", "annotation_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_ospf_timers.annotations.0.key", "key_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_ospf_timers.annotations.0.value", "test_value"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_ospf_timers.annotations.#", "1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_ospf_timers.tags.0.key", "key_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_ospf_timers.tags.0.value", "test_value"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_ospf_timers.tags.#", "1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_ospf_timers.ospf_timers_name", "ospf_timers_name_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "tags.0.key", "key_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "tags.0.value", "test_value"),
					resource.TestCheckResourceAttr("aci_vrf.test", "tags.#", "1"),
				),
				ConfigStateChecks: []statecheck.StateCheck{
					statecheck.ExpectKnownValue("aci_vrf.test",
						tfjsonpath.New("relation_to_monitoring_policy"),
						knownvalue.MapExact(
							map[string]knownvalue.Check{
								"annotation":             knownvalue.Null(),
								"annotations":            knownvalue.Null(),
								"tags":                   knownvalue.Null(),
								"monitoring_policy_name": knownvalue.Null(),
							},
						),
					),
					statecheck.ExpectKnownValue("aci_vrf.test",
						tfjsonpath.New("relation_to_wan_vpn"),
						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:             testConfigFvCtxChildrenRemoveAllDependencyWithFvTenant + testConfigDataSourceSystem,
				ExpectNonEmptyPlan: false,
				Check: resource.ComposeAggregateTestCheckFunc(
					resource.TestCheckResourceAttrSet("aci_vrf.test", "pc_tag"),
					resource.TestCheckResourceAttrSet("aci_vrf.test", "scope"),
					resource.TestCheckResourceAttr("aci_vrf.test", "annotations.#", "0"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_address_family_ospf_timers.#", "0"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_bgp_address_family_contexts.#", "0"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_bgp_timers.annotation", "annotation_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_bgp_timers.bgp_timers_name", "bgp_timers_name_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_bgp_timers.annotations.#", "0"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_bgp_timers.tags.#", "0"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_eigrp_address_family_contexts.#", "0"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_end_point_retention_policy.annotation", "annotation_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_end_point_retention_policy.annotations.#", "0"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_end_point_retention_policy.tags.#", "0"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_end_point_retention_policy.end_point_retention_policy_name", "end_point_retention_policy_name_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_l3out_route_tag_policy.annotation", "annotation_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_l3out_route_tag_policy.annotations.#", "0"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_l3out_route_tag_policy.tags.#", "0"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_l3out_route_tag_policy.l3out_route_tag_policy_name", "l3out_route_tag_policy_name_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_ospf_timers.annotation", "annotation_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_ospf_timers.annotations.#", "0"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_ospf_timers.tags.#", "0"),
					resource.TestCheckResourceAttr("aci_vrf.test", "relation_to_ospf_timers.ospf_timers_name", "ospf_timers_name_1"),
					resource.TestCheckResourceAttr("aci_vrf.test", "tags.#", "0"),
				),
				ConfigStateChecks: []statecheck.StateCheck{
					statecheck.ExpectKnownValue("aci_vrf.test",
						tfjsonpath.New("relation_to_monitoring_policy"),
						knownvalue.MapExact(
							map[string]knownvalue.Check{
								"annotation":             knownvalue.Null(),
								"annotations":            knownvalue.Null(),
								"tags":                   knownvalue.Null(),
								"monitoring_policy_name": knownvalue.Null(),
							},
						),
					),
					statecheck.ExpectKnownValue("aci_vrf.test",
						tfjsonpath.New("relation_to_wan_vpn"),
						knownvalue.MapExact(
							map[string]knownvalue.Check{
								"annotation":  knownvalue.Null(),
								"annotations": knownvalue.Null(),
								"tags":        knownvalue.Null(),
								"target_dn":   knownvalue.Null(),
							},
						),
					),
				},
			},
			// Update with legacy attribute config
			{
				Config:             testConfigFvCtxLegacyAttributesWithFvTenant + testConfigDataSourceSystem,
				ExpectNonEmptyPlan: false,
			},
		},
		CheckDestroy: testCheckResourceDestroy,
	})
	resource.Test(t, resource.TestCase{
		PreCheck:                 func() { testAccPreCheck(t, "apic", "1.0(1e)-") },
		ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
		Steps: []resource.TestStep{
			// Create with legacy attribute config
			{
				Config:             testConfigFvCtxLegacyAttributesWithFvTenant + testConfigDataSourceSystem,
				ExpectNonEmptyPlan: false,
			},
		},
		CheckDestroy: testCheckResourceDestroy,
	})
}

const testChildDependencyConfigFvCtx = `
resource "aci_bgp_timers" "test_bgp_timers_0"{
  tenant_dn = aci_tenant.test.id
  name = "bgp_timers_name_1"
}
resource "aci_monitoring_policy" "test_monitoring_policy_1"{
  tenant_dn = aci_tenant.test.id
  name = "monitoring_policy_name_1"
}
resource "aci_bgp_address_family_context" "test_bgp_address_family_context_0"{
  tenant_dn = aci_tenant.test.id
  name = "bgp_address_family_context_name_1"
}
resource "aci_eigrp_address_family_context" "test_eigrp_address_family_context_1"{
  parent_dn = aci_tenant.test.id
  name = "eigrp_address_family_context_name_1"
}
resource "aci_end_point_retention_policy" "test_end_point_retention_policy_0"{
  tenant_dn = aci_tenant.test.id
  name = "end_point_retention_policy_name_1"
}
resource "aci_l3out_route_tag_policy" "test_l3out_route_tag_policy_1"{
  tenant_dn = aci_tenant.test.id
  name = "l3out_route_tag_policy_name_1"
}
resource "aci_ospf_timers" "test_ospf_timers_0"{
  tenant_dn = aci_tenant.test.id
  name = "ospf_timers_name_1"
}
`

const testConfigFvCtxMinDependencyWithFvTenantAllowExisting = testConfigFvTenantMin + `
resource "aci_vrf" "allow_test" {
  parent_dn = aci_tenant.test.id
  name = "test_name"
}
resource "aci_vrf" "allow_test_2" {
  parent_dn = aci_tenant.test.id
  name = "test_name"
  depends_on = [aci_vrf.allow_test]
}
`

const testConfigFvCtxMinDependencyWithFvTenant = testConfigFvTenantMin + `
resource "aci_vrf" "test" {
  parent_dn = aci_tenant.test.id
  name = "test_name"
}
`

const testConfigFvCtxAllDependencyWithFvTenant = testConfigFvTenantMin + `
resource "aci_vrf" "test" {
  parent_dn = aci_tenant.test.id
  name = "test_name"
  annotation = "annotation"
  bd_enforcement = "no"
  description = "description_1"
  name_alias = "name_alias_1"
  owner_key = "owner_key_1"
  owner_tag = "owner_tag_1"
  policy_control_enforcement_direction = "egress"
  policy_control_enforcement_mode = "enforced"
  ip_data_plane_learning = provider::aci::compare_versions(data.aci_system.version.version,"inside","4.0(1h)-") ? "disabled" : null
}
`

const testConfigFvCtxResetDependencyWithFvTenant = testConfigFvTenantMin + `
resource "aci_vrf" "test" {
  parent_dn = aci_tenant.test.id
  name = "test_name"
  annotation = "orchestrator:terraform"
  bd_enforcement = "no"
  description = ""
  name_alias = ""
  owner_key = ""
  owner_tag = ""
  policy_control_enforcement_direction = "ingress"
  policy_control_enforcement_mode = "enforced"
  ip_data_plane_learning = provider::aci::compare_versions(data.aci_system.version.version,"inside","4.0(1h)-") ? "enabled" : null
}
`
const testConfigFvCtxChildrenDependencyWithFvTenant = testChildDependencyConfigFvCtx + testConfigFvTenantMin + `
resource "aci_vrf" "test" {
  parent_dn = aci_tenant.test.id
  name = "test_name"
  annotations = [
    {
      key = "key_0"
      value = "value_1"
    },
    {
      key = "key_1"
      value = "test_value"
    },
  ]
  relation_to_address_family_ospf_timers = [
    {
      address_family = "ipv4-ucast"
      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"
	    },
      ]
      ospf_timers_name = "ospf_timers_name_0"
    },
    {
      address_family = "ipv6-ucast"
      annotation = "annotation_2"
      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"
	    },
      ]
      ospf_timers_name = aci_ospf_timers.test_ospf_timers_0.name
    },
  ]
  relation_to_bgp_address_family_contexts = [
    {
      address_family = "ipv4-ucast"
      annotation = "annotation_1"
      bgp_address_family_context_name = "bgp_address_family_context_name_0"
      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"
	    },
      ]
    },
    {
      address_family = "ipv6-ucast"
      annotation = "annotation_2"
      bgp_address_family_context_name = aci_bgp_address_family_context.test_bgp_address_family_context_0.name
      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"
	    },
      ]
    },
  ]
  relation_to_bgp_timers = {
    annotation = "annotation_1"
    bgp_timers_name = aci_bgp_timers.test_bgp_timers_0.name
    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"
	  },
    ]
  }
  relation_to_eigrp_address_family_contexts = [
    {
      address_family = "ipv4-ucast"
      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"
	    },
      ]
      eigrp_address_family_context_name = "eigrp_address_family_context_name_0"
    },
    {
      address_family = "ipv6-ucast"
      annotation = "annotation_2"
      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"
	    },
      ]
      eigrp_address_family_context_name = aci_eigrp_address_family_context.test_eigrp_address_family_context_1.name
    },
  ]
  relation_to_end_point_retention_policy = {
    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"
	  },
    ]
    end_point_retention_policy_name = aci_end_point_retention_policy.test_end_point_retention_policy_0.name
  }
  relation_to_l3out_route_tag_policy = {
    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"
	  },
    ]
    l3out_route_tag_policy_name = aci_l3out_route_tag_policy.test_l3out_route_tag_policy_1.name
  }
  relation_to_monitoring_policy = {
    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"
	  },
    ]
    monitoring_policy_name = aci_monitoring_policy.test_monitoring_policy_1.name
  }
  relation_to_ospf_timers = {
    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"
	  },
    ]
    ospf_timers_name = aci_ospf_timers.test_ospf_timers_0.name
  }
  relation_to_wan_vpn = {
    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_tenant/sdwanvpncont/sdwanvpnentry-sdwanvpn_1"
  }
  tags = [
    {
      key = "key_0"
      value = "value_1"
    },
    {
      key = "key_1"
      value = "test_value"
    },
  ]
}
`

const testConfigFvCtxChildrenRemoveFromConfigDependencyWithFvTenant = testChildDependencyConfigFvCtx + testConfigFvTenantMin + `
resource "aci_vrf" "test" {
  parent_dn = aci_tenant.test.id
  name = "test_name"
}
`

const testConfigFvCtxChildrenRemoveOneDependencyWithFvTenant = testChildDependencyConfigFvCtx + testConfigFvTenantMin + `
resource "aci_vrf" "test" {
  parent_dn = aci_tenant.test.id
  name = "test_name"
  annotations = [ 
	{
	  key = "key_1"
	  value = "test_value"
	},
  ]
  relation_to_address_family_ospf_timers = [ 
	{
	  address_family = "ipv6-ucast"
	  annotation = "annotation_2"
      annotations = [ 
	    {
          key = "key_1"
          value = "test_value"
	    },
      ]
      tags = [ 
	    {
          key = "key_1"
          value = "test_value"
	    },
      ]
	  ospf_timers_name = aci_ospf_timers.test_ospf_timers_0.name
	},
  ]
  relation_to_bgp_address_family_contexts = [ 
	{
	  address_family = "ipv6-ucast"
	  annotation = "annotation_2"
	  bgp_address_family_context_name = aci_bgp_address_family_context.test_bgp_address_family_context_0.name
      annotations = [ 
	    {
          key = "key_1"
          value = "test_value"
	    },
      ]
      tags = [ 
	    {
          key = "key_1"
          value = "test_value"
	    },
      ]
	},
  ]
  relation_to_bgp_timers = {
    annotation = "annotation_1"
    bgp_timers_name = aci_bgp_timers.test_bgp_timers_0.name
    annotations = [ 
	  {
        key = "key_1"
        value = "test_value"
	  },
    ]
    tags = [ 
	  {
        key = "key_1"
        value = "test_value"
	  },
    ]
  }
  relation_to_eigrp_address_family_contexts = [ 
	{
	  address_family = "ipv6-ucast"
	  annotation = "annotation_2"
      annotations = [ 
	    {
          key = "key_1"
          value = "test_value"
	    },
      ]
      tags = [ 
	    {
          key = "key_1"
          value = "test_value"
	    },
      ]
	  eigrp_address_family_context_name = aci_eigrp_address_family_context.test_eigrp_address_family_context_1.name
	},
  ]
  relation_to_end_point_retention_policy = {
    annotation = "annotation_1"
    annotations = [ 
	  {
        key = "key_1"
        value = "test_value"
	  },
    ]
    tags = [ 
	  {
        key = "key_1"
        value = "test_value"
	  },
    ]
    end_point_retention_policy_name = aci_end_point_retention_policy.test_end_point_retention_policy_0.name
  }
  relation_to_l3out_route_tag_policy = {
    annotation = "annotation_1"
    annotations = [ 
	  {
        key = "key_1"
        value = "test_value"
	  },
    ]
    tags = [ 
	  {
        key = "key_1"
        value = "test_value"
	  },
    ]
    l3out_route_tag_policy_name = aci_l3out_route_tag_policy.test_l3out_route_tag_policy_1.name
  }
  relation_to_monitoring_policy = {}
  relation_to_ospf_timers = {
    annotation = "annotation_1"
    annotations = [ 
	  {
        key = "key_1"
        value = "test_value"
	  },
    ]
    tags = [ 
	  {
        key = "key_1"
        value = "test_value"
	  },
    ]
    ospf_timers_name = aci_ospf_timers.test_ospf_timers_0.name
  }
  relation_to_wan_vpn = {}
  tags = [ 
	{
	  key = "key_1"
	  value = "test_value"
	},
  ]
}
`

const testConfigFvCtxChildrenRemoveAllDependencyWithFvTenant = testChildDependencyConfigFvCtx + testConfigFvTenantMin + `
resource "aci_vrf" "test" {
  parent_dn = aci_tenant.test.id
  name = "test_name"
  annotations = []
  relation_to_address_family_ospf_timers = []
  relation_to_bgp_address_family_contexts = []
  relation_to_bgp_timers = {
    annotation = "annotation_1"
    bgp_timers_name = aci_bgp_timers.test_bgp_timers_0.name
    annotations = []
    tags = []
  }
  relation_to_eigrp_address_family_contexts = []
  relation_to_end_point_retention_policy = {
    annotation = "annotation_1"
    annotations = []
    tags = []
    end_point_retention_policy_name = aci_end_point_retention_policy.test_end_point_retention_policy_0.name
  }
  relation_to_l3out_route_tag_policy = {
    annotation = "annotation_1"
    annotations = []
    tags = []
    l3out_route_tag_policy_name = aci_l3out_route_tag_policy.test_l3out_route_tag_policy_1.name
  }
  relation_to_monitoring_policy = {}
  relation_to_ospf_timers = {
    annotation = "annotation_1"
    annotations = []
    tags = []
    ospf_timers_name = aci_ospf_timers.test_ospf_timers_0.name
  }
  relation_to_wan_vpn = {}
  tags = []
}
`

const testConfigFvCtxLegacyAttributesWithFvTenant = testChildDependencyConfigFvCtx + testConfigFvTenantMin + `
resource "aci_vrf" "test" {
  name = "test_name"
  bd_enforced_enable = "no"
  pc_enf_dir = "egress"
  pc_enf_pref = "enforced"
  relation_fv_rs_bgp_ctx_pol = aci_bgp_timers.test_bgp_timers_0.id
  relation_fv_rs_ctx_mon_pol = aci_monitoring_policy.test_monitoring_policy_1.id
  relation_fv_rs_ctx_to_ep_ret = aci_end_point_retention_policy.test_end_point_retention_policy_0.id
  relation_fv_rs_ctx_to_ext_route_tag_pol = aci_l3out_route_tag_policy.test_l3out_route_tag_policy_1.id
  relation_fv_rs_ospf_ctx_pol = aci_ospf_timers.test_ospf_timers_0.id
  tenant_dn = aci_tenant.test.id
  relation_fv_rs_ctx_to_bgp_ctx_af_pol {
    af = "ipv4-ucast"
    tn_bgp_ctx_af_pol_name = aci_bgp_address_family_context.test_bgp_address_family_context_0.id
  }
  relation_fv_rs_ctx_to_eigrp_ctx_af_pol {
    af = "ipv4-ucast"
    tn_eigrp_ctx_af_pol_name = aci_eigrp_address_family_context.test_eigrp_address_family_context_1.id
  }
  relation_fv_rs_ctx_to_ospf_ctx_pol {
    af = "ipv4-ucast"
    tn_ospf_ctx_pol_name = aci_ospf_timers.test_ospf_timers_0.id
  }
}
`
