// 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"
)

func TestAccResourceVzAnyWithFvCtx(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:             testConfigVzAnyMinDependencyWithFvCtxAllowExisting,
				ExpectNonEmptyPlan: false,
				Check: resource.ComposeAggregateTestCheckFunc(
					resource.TestCheckResourceAttr("aci_any.allow_test", "annotation", "orchestrator:terraform"),
					resource.TestCheckResourceAttr("aci_any.allow_test_2", "annotation", "orchestrator:terraform"),
					resource.TestCheckResourceAttr("aci_any.allow_test", "description", ""),
					resource.TestCheckResourceAttr("aci_any.allow_test_2", "description", ""),
					resource.TestCheckResourceAttr("aci_any.allow_test", "match_criteria", "AtleastOne"),
					resource.TestCheckResourceAttr("aci_any.allow_test_2", "match_criteria", "AtleastOne"),
					resource.TestCheckResourceAttr("aci_any.allow_test", "name", ""),
					resource.TestCheckResourceAttr("aci_any.allow_test_2", "name", ""),
					resource.TestCheckResourceAttr("aci_any.allow_test", "name_alias", ""),
					resource.TestCheckResourceAttr("aci_any.allow_test_2", "name_alias", ""),
					resource.TestCheckResourceAttr("aci_any.allow_test", "preferred_group_member", "disabled"),
					resource.TestCheckResourceAttr("aci_any.allow_test_2", "preferred_group_member", "disabled"),
				),
			},
		},
	})

	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:      testConfigVzAnyMinDependencyWithFvCtxAllowExisting,
				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:             testConfigVzAnyMinDependencyWithFvCtxAllowExisting,
				ExpectNonEmptyPlan: false,
				Check: resource.ComposeAggregateTestCheckFunc(
					resource.TestCheckResourceAttr("aci_any.allow_test", "annotation", "orchestrator:terraform"),
					resource.TestCheckResourceAttr("aci_any.allow_test_2", "annotation", "orchestrator:terraform"),
					resource.TestCheckResourceAttr("aci_any.allow_test", "description", ""),
					resource.TestCheckResourceAttr("aci_any.allow_test_2", "description", ""),
					resource.TestCheckResourceAttr("aci_any.allow_test", "match_criteria", "AtleastOne"),
					resource.TestCheckResourceAttr("aci_any.allow_test_2", "match_criteria", "AtleastOne"),
					resource.TestCheckResourceAttr("aci_any.allow_test", "name", ""),
					resource.TestCheckResourceAttr("aci_any.allow_test_2", "name", ""),
					resource.TestCheckResourceAttr("aci_any.allow_test", "name_alias", ""),
					resource.TestCheckResourceAttr("aci_any.allow_test_2", "name_alias", ""),
					resource.TestCheckResourceAttr("aci_any.allow_test", "preferred_group_member", "disabled"),
					resource.TestCheckResourceAttr("aci_any.allow_test_2", "preferred_group_member", "disabled"),
				),
			},
		},
	})

	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:             testConfigVzAnyMinDependencyWithFvCtx,
				ExpectNonEmptyPlan: false,
				Check: resource.ComposeAggregateTestCheckFunc(
					resource.TestCheckResourceAttr("aci_any.test", "annotation", "orchestrator:terraform"),
					resource.TestCheckResourceAttr("aci_any.test", "description", ""),
					resource.TestCheckResourceAttr("aci_any.test", "match_criteria", "AtleastOne"),
					resource.TestCheckResourceAttr("aci_any.test", "name", ""),
					resource.TestCheckResourceAttr("aci_any.test", "name_alias", ""),
					resource.TestCheckResourceAttr("aci_any.test", "preferred_group_member", "disabled"),
				),
			},
			// Update with all config and verify default APIC values
			{
				Config:             testConfigVzAnyAllDependencyWithFvCtx,
				ExpectNonEmptyPlan: false,
				Check: resource.ComposeAggregateTestCheckFunc(
					resource.TestCheckResourceAttr("aci_any.test", "annotation", "annotation"),
					resource.TestCheckResourceAttr("aci_any.test", "description", "description_1"),
					resource.TestCheckResourceAttr("aci_any.test", "match_criteria", "All"),
					resource.TestCheckResourceAttr("aci_any.test", "name", "name_1"),
					resource.TestCheckResourceAttr("aci_any.test", "name_alias", "name_alias_1"),
					resource.TestCheckResourceAttr("aci_any.test", "preferred_group_member", "disabled"),
				),
			},
			// Update with minimum config and verify config is unchanged
			{
				Config:             testConfigVzAnyMinDependencyWithFvCtx,
				ExpectNonEmptyPlan: false,
				Check:              resource.ComposeAggregateTestCheckFunc(),
			},
			// Update with empty strings config or default value
			{
				Config:             testConfigVzAnyResetDependencyWithFvCtx,
				ExpectNonEmptyPlan: false,
				Check:              resource.ComposeAggregateTestCheckFunc(),
			},
			// Import testing
			{
				ResourceName:      "aci_any.test",
				ImportState:       true,
				ImportStateVerify: true,
			},
			// Update with children
			{
				Config:             testConfigVzAnyChildrenDependencyWithFvCtx,
				ExpectNonEmptyPlan: false,
				Check: resource.ComposeAggregateTestCheckFunc(
					resource.TestCheckResourceAttr("aci_any.test", "annotation", "orchestrator:terraform"),
					resource.TestCheckResourceAttr("aci_any.test", "description", ""),
					resource.TestCheckResourceAttr("aci_any.test", "match_criteria", "AtleastOne"),
					resource.TestCheckResourceAttr("aci_any.test", "name", ""),
					resource.TestCheckResourceAttr("aci_any.test", "name_alias", ""),
					resource.TestCheckResourceAttr("aci_any.test", "preferred_group_member", "disabled"),
					resource.TestCheckResourceAttr("aci_any.test", "annotations.0.key", "key_0"),
					resource.TestCheckResourceAttr("aci_any.test", "annotations.0.value", "value_1"),
					resource.TestCheckResourceAttr("aci_any.test", "annotations.1.key", "key_1"),
					resource.TestCheckResourceAttr("aci_any.test", "annotations.1.value", "test_value"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_consumer_contracts.0.annotation", "annotation_1"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_consumer_contracts.0.contract_name", "contract_name_0"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_consumer_contracts.0.priority", "level1"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_consumer_contracts.1.annotation", "annotation_2"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_consumer_contracts.1.contract_name", "contract_name_1"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_consumer_contracts.1.priority", "level2"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_contract_interfaces.0.annotation", "annotation_1"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_contract_interfaces.0.imported_contract_name", "imported_contract_name_0"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_contract_interfaces.0.priority", "level1"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_contract_interfaces.1.annotation", "annotation_2"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_contract_interfaces.1.imported_contract_name", "imported_contract_name_1"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_contract_interfaces.1.priority", "level2"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_provider_contracts.0.annotation", "annotation_1"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_provider_contracts.0.contract_name", "contract_name_0"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_provider_contracts.0.match_criteria", "All"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_provider_contracts.0.priority", "level1"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_provider_contracts.1.annotation", "annotation_2"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_provider_contracts.1.contract_name", "contract_name_1"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_provider_contracts.1.match_criteria", "AtleastOne"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_provider_contracts.1.priority", "level2"),
					resource.TestCheckResourceAttr("aci_any.test", "tags.0.key", "key_0"),
					resource.TestCheckResourceAttr("aci_any.test", "tags.0.value", "value_1"),
					resource.TestCheckResourceAttr("aci_any.test", "tags.1.key", "key_1"),
					resource.TestCheckResourceAttr("aci_any.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_any.test",
				ImportState:       true,
				ImportStateVerify: true,
			},
			// Update with children removed from config
			{
				Config:             testConfigVzAnyChildrenRemoveFromConfigDependencyWithFvCtx,
				ExpectNonEmptyPlan: false,
				Check: resource.ComposeAggregateTestCheckFunc(
					resource.TestCheckResourceAttr("aci_any.test", "annotations.0.key", "key_0"),
					resource.TestCheckResourceAttr("aci_any.test", "annotations.0.value", "value_1"),
					resource.TestCheckResourceAttr("aci_any.test", "annotations.1.key", "key_1"),
					resource.TestCheckResourceAttr("aci_any.test", "annotations.1.value", "test_value"),
					resource.TestCheckResourceAttr("aci_any.test", "annotations.#", "2"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_consumer_contracts.0.annotation", "annotation_1"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_consumer_contracts.0.annotations.0.key", "key_0"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_consumer_contracts.0.annotations.0.value", "value_1"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_consumer_contracts.0.annotations.1.key", "key_1"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_consumer_contracts.0.annotations.1.value", "test_value"),
					resource.TestCheckResourceAttr("aci_any.test", "annotations.#", "2"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_consumer_contracts.0.tags.0.key", "key_0"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_consumer_contracts.0.tags.0.value", "value_1"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_consumer_contracts.0.tags.1.key", "key_1"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_consumer_contracts.0.tags.1.value", "test_value"),
					resource.TestCheckResourceAttr("aci_any.test", "tags.#", "2"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_consumer_contracts.0.contract_name", "contract_name_0"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_consumer_contracts.0.priority", "level1"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_consumer_contracts.1.annotation", "annotation_2"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_consumer_contracts.1.annotations.0.key", "key_0"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_consumer_contracts.1.annotations.0.value", "value_1"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_consumer_contracts.1.annotations.1.key", "key_1"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_consumer_contracts.1.annotations.1.value", "test_value"),
					resource.TestCheckResourceAttr("aci_any.test", "annotations.#", "2"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_consumer_contracts.1.tags.0.key", "key_0"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_consumer_contracts.1.tags.0.value", "value_1"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_consumer_contracts.1.tags.1.key", "key_1"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_consumer_contracts.1.tags.1.value", "test_value"),
					resource.TestCheckResourceAttr("aci_any.test", "tags.#", "2"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_consumer_contracts.1.contract_name", "contract_name_1"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_consumer_contracts.1.priority", "level2"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_consumer_contracts.#", "2"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_contract_interfaces.0.annotation", "annotation_1"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_contract_interfaces.0.annotations.0.key", "key_0"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_contract_interfaces.0.annotations.0.value", "value_1"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_contract_interfaces.0.annotations.1.key", "key_1"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_contract_interfaces.0.annotations.1.value", "test_value"),
					resource.TestCheckResourceAttr("aci_any.test", "annotations.#", "2"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_contract_interfaces.0.tags.0.key", "key_0"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_contract_interfaces.0.tags.0.value", "value_1"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_contract_interfaces.0.tags.1.key", "key_1"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_contract_interfaces.0.tags.1.value", "test_value"),
					resource.TestCheckResourceAttr("aci_any.test", "tags.#", "2"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_contract_interfaces.0.imported_contract_name", "imported_contract_name_0"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_contract_interfaces.0.priority", "level1"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_contract_interfaces.1.annotation", "annotation_2"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_contract_interfaces.1.annotations.0.key", "key_0"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_contract_interfaces.1.annotations.0.value", "value_1"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_contract_interfaces.1.annotations.1.key", "key_1"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_contract_interfaces.1.annotations.1.value", "test_value"),
					resource.TestCheckResourceAttr("aci_any.test", "annotations.#", "2"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_contract_interfaces.1.tags.0.key", "key_0"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_contract_interfaces.1.tags.0.value", "value_1"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_contract_interfaces.1.tags.1.key", "key_1"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_contract_interfaces.1.tags.1.value", "test_value"),
					resource.TestCheckResourceAttr("aci_any.test", "tags.#", "2"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_contract_interfaces.1.imported_contract_name", "imported_contract_name_1"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_contract_interfaces.1.priority", "level2"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_contract_interfaces.#", "2"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_provider_contracts.0.annotation", "annotation_1"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_provider_contracts.0.annotations.0.key", "key_0"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_provider_contracts.0.annotations.0.value", "value_1"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_provider_contracts.0.annotations.1.key", "key_1"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_provider_contracts.0.annotations.1.value", "test_value"),
					resource.TestCheckResourceAttr("aci_any.test", "annotations.#", "2"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_provider_contracts.0.tags.0.key", "key_0"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_provider_contracts.0.tags.0.value", "value_1"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_provider_contracts.0.tags.1.key", "key_1"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_provider_contracts.0.tags.1.value", "test_value"),
					resource.TestCheckResourceAttr("aci_any.test", "tags.#", "2"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_provider_contracts.0.contract_name", "contract_name_0"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_provider_contracts.0.match_criteria", "All"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_provider_contracts.0.priority", "level1"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_provider_contracts.1.annotation", "annotation_2"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_provider_contracts.1.annotations.0.key", "key_0"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_provider_contracts.1.annotations.0.value", "value_1"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_provider_contracts.1.annotations.1.key", "key_1"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_provider_contracts.1.annotations.1.value", "test_value"),
					resource.TestCheckResourceAttr("aci_any.test", "annotations.#", "2"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_provider_contracts.1.tags.0.key", "key_0"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_provider_contracts.1.tags.0.value", "value_1"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_provider_contracts.1.tags.1.key", "key_1"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_provider_contracts.1.tags.1.value", "test_value"),
					resource.TestCheckResourceAttr("aci_any.test", "tags.#", "2"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_provider_contracts.1.contract_name", "contract_name_1"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_provider_contracts.1.match_criteria", "AtleastOne"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_provider_contracts.1.priority", "level2"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_provider_contracts.#", "2"),
					resource.TestCheckResourceAttr("aci_any.test", "tags.0.key", "key_0"),
					resource.TestCheckResourceAttr("aci_any.test", "tags.0.value", "value_1"),
					resource.TestCheckResourceAttr("aci_any.test", "tags.1.key", "key_1"),
					resource.TestCheckResourceAttr("aci_any.test", "tags.1.value", "test_value"),
					resource.TestCheckResourceAttr("aci_any.test", "tags.#", "2"),
				),
			},
			// Update with children first child removed
			{
				Config:             testConfigVzAnyChildrenRemoveOneDependencyWithFvCtx,
				ExpectNonEmptyPlan: false,
				Check: resource.ComposeAggregateTestCheckFunc(
					resource.TestCheckResourceAttr("aci_any.test", "annotations.0.key", "key_1"),
					resource.TestCheckResourceAttr("aci_any.test", "annotations.0.value", "test_value"),
					resource.TestCheckResourceAttr("aci_any.test", "annotations.#", "1"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_consumer_contracts.0.annotation", "annotation_2"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_consumer_contracts.0.annotations.0.key", "key_1"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_consumer_contracts.0.annotations.0.value", "test_value"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_consumer_contracts.0.annotations.#", "1"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_consumer_contracts.0.tags.0.key", "key_1"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_consumer_contracts.0.tags.0.value", "test_value"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_consumer_contracts.0.tags.#", "1"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_consumer_contracts.0.contract_name", "contract_name_1"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_consumer_contracts.0.priority", "level2"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_consumer_contracts.#", "1"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_contract_interfaces.0.annotation", "annotation_2"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_contract_interfaces.0.annotations.0.key", "key_1"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_contract_interfaces.0.annotations.0.value", "test_value"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_contract_interfaces.0.annotations.#", "1"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_contract_interfaces.0.tags.0.key", "key_1"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_contract_interfaces.0.tags.0.value", "test_value"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_contract_interfaces.0.tags.#", "1"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_contract_interfaces.0.imported_contract_name", "imported_contract_name_1"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_contract_interfaces.0.priority", "level2"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_contract_interfaces.#", "1"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_provider_contracts.0.annotation", "annotation_2"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_provider_contracts.0.annotations.0.key", "key_1"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_provider_contracts.0.annotations.0.value", "test_value"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_provider_contracts.0.annotations.#", "1"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_provider_contracts.0.tags.0.key", "key_1"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_provider_contracts.0.tags.0.value", "test_value"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_provider_contracts.0.tags.#", "1"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_provider_contracts.0.contract_name", "contract_name_1"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_provider_contracts.0.match_criteria", "AtleastOne"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_provider_contracts.0.priority", "level2"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_provider_contracts.#", "1"),
					resource.TestCheckResourceAttr("aci_any.test", "tags.0.key", "key_1"),
					resource.TestCheckResourceAttr("aci_any.test", "tags.0.value", "test_value"),
					resource.TestCheckResourceAttr("aci_any.test", "tags.#", "1"),
				),
			},
			// Update with all children removed
			{
				Config:             testConfigVzAnyChildrenRemoveAllDependencyWithFvCtx,
				ExpectNonEmptyPlan: false,
				Check: resource.ComposeAggregateTestCheckFunc(
					resource.TestCheckResourceAttr("aci_any.test", "annotations.#", "0"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_consumer_contracts.#", "0"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_contract_interfaces.#", "0"),
					resource.TestCheckResourceAttr("aci_any.test", "relation_to_provider_contracts.#", "0"),
					resource.TestCheckResourceAttr("aci_any.test", "tags.#", "0"),
				),
			},
			// Update with legacy attribute config
			{
				Config:             testConfigVzAnyLegacyAttributesWithFvCtx,
				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:             testConfigVzAnyLegacyAttributesWithFvCtx,
				ExpectNonEmptyPlan: false,
			},
		},
		CheckDestroy: testCheckResourceDestroy,
	})
}

const testChildDependencyConfigVzAny = `
resource "aci_contract" "test_contract_0"{
  tenant_dn = aci_tenant.test.id
  name = "contract_name_0"
}
resource "aci_imported_contract" "test_imported_contract_1"{
  tenant_dn = aci_tenant.test.id
  name = "imported_contract_name_0"
}
resource "aci_imported_contract" "test_imported_contract_0"{
  tenant_dn = aci_tenant.test.id
  name = "imported_contract_name_1"
}
resource "aci_contract" "test_contract_1"{
  tenant_dn = aci_tenant.test.id
  name = "contract_name_1"
}
`

const testConfigVzAnyMinDependencyWithFvCtxAllowExisting = testConfigFvCtxMinDependencyWithFvTenant + `
resource "aci_any" "allow_test" {
  parent_dn = aci_vrf.test.id
}
resource "aci_any" "allow_test_2" {
  parent_dn = aci_vrf.test.id
  depends_on = [aci_any.allow_test]
}
`

const testConfigVzAnyMinDependencyWithFvCtx = testConfigFvCtxMinDependencyWithFvTenant + `
resource "aci_any" "test" {
  parent_dn = aci_vrf.test.id
}
`

const testConfigVzAnyAllDependencyWithFvCtx = testConfigFvCtxMinDependencyWithFvTenant + `
resource "aci_any" "test" {
  parent_dn = aci_vrf.test.id
  annotation = "annotation"
  description = "description_1"
  match_criteria = "All"
  name = "name_1"
  name_alias = "name_alias_1"
  preferred_group_member = "disabled"
}
`

const testConfigVzAnyResetDependencyWithFvCtx = testConfigFvCtxMinDependencyWithFvTenant + `
resource "aci_any" "test" {
  parent_dn = aci_vrf.test.id
  annotation = "orchestrator:terraform"
  description = ""
  match_criteria = "AtleastOne"
  name = ""
  name_alias = ""
  preferred_group_member = "disabled"
}
`
const testConfigVzAnyChildrenDependencyWithFvCtx = testChildDependencyConfigVzAny + testConfigFvCtxMinDependencyWithFvTenant + `
resource "aci_any" "test" {
  parent_dn = aci_vrf.test.id
  annotations = [
    {
      key = "key_0"
      value = "value_1"
    },
    {
      key = "key_1"
      value = "test_value"
    },
  ]
  relation_to_consumer_contracts = [
    {
      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"
	    },
      ]
      contract_name = aci_contract.test_contract_0.name
      priority = "level1"
    },
    {
      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"
	    },
      ]
      contract_name = aci_contract.test_contract_1.name
      priority = "level2"
    },
  ]
  relation_to_contract_interfaces = [
    {
      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"
	    },
      ]
      imported_contract_name = aci_imported_contract.test_imported_contract_1.name
      priority = "level1"
    },
    {
      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"
	    },
      ]
      imported_contract_name = aci_imported_contract.test_imported_contract_0.name
      priority = "level2"
    },
  ]
  relation_to_provider_contracts = [
    {
      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"
	    },
      ]
      contract_name = aci_contract.test_contract_0.name
      match_criteria = "All"
      priority = "level1"
    },
    {
      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"
	    },
      ]
      contract_name = aci_contract.test_contract_1.name
      match_criteria = "AtleastOne"
      priority = "level2"
    },
  ]
  tags = [
    {
      key = "key_0"
      value = "value_1"
    },
    {
      key = "key_1"
      value = "test_value"
    },
  ]
}
`

const testConfigVzAnyChildrenRemoveFromConfigDependencyWithFvCtx = testChildDependencyConfigVzAny + testConfigFvCtxMinDependencyWithFvTenant + `
resource "aci_any" "test" {
  parent_dn = aci_vrf.test.id
}
`

const testConfigVzAnyChildrenRemoveOneDependencyWithFvCtx = testChildDependencyConfigVzAny + testConfigFvCtxMinDependencyWithFvTenant + `
resource "aci_any" "test" {
  parent_dn = aci_vrf.test.id
  annotations = [ 
	{
	  key = "key_1"
	  value = "test_value"
	},
  ]
  relation_to_consumer_contracts = [ 
	{
	  annotation = "annotation_2"
      annotations = [ 
	    {
          key = "key_1"
          value = "test_value"
	    },
      ]
      tags = [ 
	    {
          key = "key_1"
          value = "test_value"
	    },
      ]
	  contract_name = aci_contract.test_contract_1.name
	  priority = "level2"
	},
  ]
  relation_to_contract_interfaces = [ 
	{
	  annotation = "annotation_2"
      annotations = [ 
	    {
          key = "key_1"
          value = "test_value"
	    },
      ]
      tags = [ 
	    {
          key = "key_1"
          value = "test_value"
	    },
      ]
	  imported_contract_name = aci_imported_contract.test_imported_contract_0.name
	  priority = "level2"
	},
  ]
  relation_to_provider_contracts = [ 
	{
	  annotation = "annotation_2"
      annotations = [ 
	    {
          key = "key_1"
          value = "test_value"
	    },
      ]
      tags = [ 
	    {
          key = "key_1"
          value = "test_value"
	    },
      ]
	  contract_name = aci_contract.test_contract_1.name
	  match_criteria = "AtleastOne"
	  priority = "level2"
	},
  ]
  tags = [ 
	{
	  key = "key_1"
	  value = "test_value"
	},
  ]
}
`

const testConfigVzAnyChildrenRemoveAllDependencyWithFvCtx = testChildDependencyConfigVzAny + testConfigFvCtxMinDependencyWithFvTenant + `
resource "aci_any" "test" {
  parent_dn = aci_vrf.test.id
  annotations = []
  relation_to_consumer_contracts = []
  relation_to_contract_interfaces = []
  relation_to_provider_contracts = []
  tags = []
}
`

const testConfigVzAnyLegacyAttributesWithFvCtx = testChildDependencyConfigVzAny + testConfigFvCtxMinDependencyWithFvTenant + `
resource "aci_any" "test" {
  match_t = "All"
  pref_gr_memb = "disabled"
  relation_vz_rs_any_to_cons = [aci_contract.test_contract_1.id]
  relation_vz_rs_any_to_cons_if = [aci_imported_contract.test_imported_contract_0.id]
  relation_vz_rs_any_to_prov = [aci_contract.test_contract_1.id]
  vrf_dn = aci_vrf.test.id
}
`
