// 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 TestAccResourcePkiKeyRing(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:             testConfigPkiKeyRingMinAllowExisting + testConfigDataSourceSystem,
				ExpectNonEmptyPlan: false,
				Check: resource.ComposeAggregateTestCheckFunc(
					resource.TestCheckResourceAttr("aci_key_ring.allow_test", "name", "test_name"),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test_2", "name", "test_name"),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test", "admin_state", "started"),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test_2", "admin_state", "started"),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test", "annotation", "orchestrator:terraform"),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test_2", "annotation", "orchestrator:terraform"),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test", "certificate", ""),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test_2", "certificate", ""),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test", "certificate_authority", ""),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test_2", "certificate_authority", ""),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test", "description", ""),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test_2", "description", ""),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test", "modulus", "mod2048"),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test_2", "modulus", "mod2048"),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test", "name_alias", ""),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test_2", "name_alias", ""),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test", "owner_key", ""),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test_2", "owner_key", ""),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test", "owner_tag", ""),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test_2", "owner_tag", ""),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test", "regenerate", "no"),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test_2", "regenerate", "no"),
					composeAggregateTestCheckFuncWithVersion(t, "6.0(2h)-", "inside",
						resource.TestCheckResourceAttr("aci_key_ring.allow_test", "elliptic_curve", "none"),
						resource.TestCheckResourceAttr("aci_key_ring.allow_test_2", "elliptic_curve", "none"),
						resource.TestCheckResourceAttr("aci_key_ring.allow_test", "key_type", "RSA"),
						resource.TestCheckResourceAttr("aci_key_ring.allow_test_2", "key_type", "RSA")),
				),
			},
		},
	})

	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:      testConfigPkiKeyRingMinAllowExisting + 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:             testConfigPkiKeyRingMinAllowExisting + testConfigDataSourceSystem,
				ExpectNonEmptyPlan: false,
				Check: resource.ComposeAggregateTestCheckFunc(
					resource.TestCheckResourceAttr("aci_key_ring.allow_test", "name", "test_name"),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test_2", "name", "test_name"),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test", "admin_state", "started"),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test_2", "admin_state", "started"),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test", "annotation", "orchestrator:terraform"),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test_2", "annotation", "orchestrator:terraform"),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test", "certificate", ""),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test_2", "certificate", ""),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test", "certificate_authority", ""),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test_2", "certificate_authority", ""),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test", "description", ""),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test_2", "description", ""),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test", "modulus", "mod2048"),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test_2", "modulus", "mod2048"),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test", "name_alias", ""),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test_2", "name_alias", ""),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test", "owner_key", ""),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test_2", "owner_key", ""),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test", "owner_tag", ""),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test_2", "owner_tag", ""),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test", "regenerate", "no"),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test_2", "regenerate", "no"),
					composeAggregateTestCheckFuncWithVersion(t, "6.0(2h)-", "inside",
						resource.TestCheckResourceAttr("aci_key_ring.allow_test", "elliptic_curve", "none"),
						resource.TestCheckResourceAttr("aci_key_ring.allow_test_2", "elliptic_curve", "none"),
						resource.TestCheckResourceAttr("aci_key_ring.allow_test", "key_type", "RSA"),
						resource.TestCheckResourceAttr("aci_key_ring.allow_test_2", "key_type", "RSA")),
				),
			},
		},
	})

	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:             testConfigPkiKeyRingMin + testConfigDataSourceSystem,
				ExpectNonEmptyPlan: false,
				Check: resource.ComposeAggregateTestCheckFunc(
					resource.TestCheckResourceAttr("aci_key_ring.test", "name", "test_name"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "admin_state", "started"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "annotation", "orchestrator:terraform"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "certificate", ""),
					resource.TestCheckResourceAttr("aci_key_ring.test", "certificate_authority", ""),
					resource.TestCheckResourceAttr("aci_key_ring.test", "description", ""),
					resource.TestCheckResourceAttr("aci_key_ring.test", "modulus", "mod2048"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "name_alias", ""),
					resource.TestCheckResourceAttr("aci_key_ring.test", "owner_key", ""),
					resource.TestCheckResourceAttr("aci_key_ring.test", "owner_tag", ""),
					resource.TestCheckResourceAttr("aci_key_ring.test", "regenerate", "no"),
					composeAggregateTestCheckFuncWithVersion(t, "6.0(2h)-", "inside",
						resource.TestCheckResourceAttr("aci_key_ring.test", "elliptic_curve", "none"),
						resource.TestCheckResourceAttr("aci_key_ring.test", "key_type", "RSA")),
				),
			},
			// Update with all config and verify default APIC values
			{
				Config:             testConfigPkiKeyRingAll + testConfigDataSourceSystem,
				ExpectNonEmptyPlan: false,
				Check: resource.ComposeAggregateTestCheckFunc(
					resource.TestCheckResourceAttr("aci_key_ring.test", "name", "test_name"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "admin_state", "completed"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "annotation", "annotation"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "certificate", "-----BEGIN CERTIFICATE-----\nMIICODCCAaGgAwIBAgIJAIt8XMntue0VMA0GCSqGSIb3DQEBCwUAMDQxDjAMBgNV\nBAMMBUFkbWluMRUwEwYDVQQKDAxZb3VyIENvbXBhbnkxCzAJBgNVBAYTAlVTMCAX\nDTE4MDEwOTAwNTk0NFoYDzIxMTcxMjE2MDA1OTQ0WjA0MQ4wDAYDVQQDDAVBZG1p\nbjEVMBMGA1UECgwMWW91ciBDb21wYW55MQswCQYDVQQGEwJVUzCBnzANBgkqhkiG\n9w0BAQEFAAOBjQAwgYkCgYEAohG/7axtt7CbSaMP7r+2mhTKbNgh0Ww36C7Ta14i\nv+VmLyKkQHnXinKGhp6uy3Nug+15a+eIu7CrgpBVMQeCiWfsnwRocKcQJWIYDrWl\nXHxGQn31yYKR6mylE7Dcj3rMFybnyhezr5D8GcP85YRPmwG9H2hO/0Y1FUnWu9Iw\nAQkCAwEAAaNQME4wHQYDVR0OBBYEFD0jLXfpkrU/ChzRvfruRs/fy1VXMB8GA1Ud\nIwQYMBaAFD0jLXfpkrU/ChzRvfruRs/fy1VXMAwGA1UdEwQFMAMBAf8wDQYJKoZI\nhvcNAQELBQADgYEAOmvre+5tgZ0+F3DgsfxNQqLTrGiBgGCIymPkP/cBXXkNuJyl\n3ac7tArHQc7WEA4U2R2rZbEq8FC3UJJm4nUVtCPvEh3G9OhN2xwYev79yt6pIn/l\nKU0Td2OpVyo0eLqjoX5u2G90IBWzhyjFbo+CcKMrSVKj1YOdG0E3OuiJf00=\n-----END CERTIFICATE-----"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "certificate_authority", "test_name"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "description", "description_1"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "modulus", "mod1024"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "name_alias", "name_alias_1"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "owner_key", "owner_key_1"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "owner_tag", "owner_tag_1"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "regenerate", "no"),
					composeAggregateTestCheckFuncWithVersion(t, "6.0(2h)-", "inside",
						resource.TestCheckResourceAttr("aci_key_ring.test", "elliptic_curve", "none"),
						resource.TestCheckResourceAttr("aci_key_ring.test", "key_type", "RSA")),
				),
			},
			// Update with minimum config and verify config is unchanged
			{
				Config:             testConfigPkiKeyRingMin + testConfigDataSourceSystem,
				ExpectNonEmptyPlan: false,
				Check: resource.ComposeAggregateTestCheckFunc(
					resource.TestCheckResourceAttr("aci_key_ring.test", "name", "test_name"),
				),
			},
			// Update with empty strings config or default value
			{
				Config:             testConfigPkiKeyRingReset + testConfigDataSourceSystem,
				ExpectNonEmptyPlan: false,
				Check: resource.ComposeAggregateTestCheckFunc(
					resource.TestCheckResourceAttr("aci_key_ring.test", "name", "test_name"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "admin_state", "started"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "annotation", "orchestrator:terraform"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "certificate", ""),
					resource.TestCheckResourceAttr("aci_key_ring.test", "certificate_authority", ""),
					resource.TestCheckResourceAttr("aci_key_ring.test", "description", ""),
					resource.TestCheckResourceAttr("aci_key_ring.test", "modulus", "mod2048"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "name_alias", ""),
					resource.TestCheckResourceAttr("aci_key_ring.test", "owner_key", ""),
					resource.TestCheckResourceAttr("aci_key_ring.test", "owner_tag", ""),
					resource.TestCheckResourceAttr("aci_key_ring.test", "regenerate", "no"),
					composeAggregateTestCheckFuncWithVersion(t, "6.0(2h)-", "inside",
						resource.TestCheckResourceAttr("aci_key_ring.test", "elliptic_curve", "none"),
						resource.TestCheckResourceAttr("aci_key_ring.test", "key_type", "RSA")),
				),
			},
			// Import testing
			{
				ResourceName:            "aci_key_ring.test",
				ImportState:             true,
				ImportStateVerify:       true,
				ImportStateVerifyIgnore: []string{"key"},
			},
			// Update with children
			{
				Config:             testConfigPkiKeyRingChildren + testConfigDataSourceSystem,
				ExpectNonEmptyPlan: false,
				Check: resource.ComposeAggregateTestCheckFunc(
					resource.TestCheckResourceAttr("aci_key_ring.test", "name", "test_name"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "admin_state", "started"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "annotation", "orchestrator:terraform"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "certificate", ""),
					resource.TestCheckResourceAttr("aci_key_ring.test", "certificate_authority", ""),
					resource.TestCheckResourceAttr("aci_key_ring.test", "description", ""),
					resource.TestCheckResourceAttr("aci_key_ring.test", "modulus", "mod2048"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "name_alias", ""),
					resource.TestCheckResourceAttr("aci_key_ring.test", "owner_key", ""),
					resource.TestCheckResourceAttr("aci_key_ring.test", "owner_tag", ""),
					resource.TestCheckResourceAttr("aci_key_ring.test", "regenerate", "no"),
					composeAggregateTestCheckFuncWithVersion(t, "6.0(2h)-", "inside",
						resource.TestCheckResourceAttr("aci_key_ring.test", "elliptic_curve", "none"),
						resource.TestCheckResourceAttr("aci_key_ring.test", "key_type", "RSA")),
					resource.TestCheckResourceAttr("aci_key_ring.test", "annotations.0.key", "key_0"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "annotations.0.value", "value_1"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "annotations.1.key", "key_1"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "annotations.1.value", "test_value"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "tags.0.key", "key_0"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "tags.0.value", "value_1"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "tags.1.key", "key_1"),
					resource.TestCheckResourceAttr("aci_key_ring.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_key_ring.test",
				ImportState:             true,
				ImportStateVerify:       true,
				ImportStateVerifyIgnore: []string{"key"},
			},
			// Update with children removed from config
			{
				Config:             testConfigPkiKeyRingChildrenRemoveFromConfig + testConfigDataSourceSystem,
				ExpectNonEmptyPlan: false,
				Check: resource.ComposeAggregateTestCheckFunc(
					resource.TestCheckResourceAttr("aci_key_ring.test", "annotations.0.key", "key_0"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "annotations.0.value", "value_1"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "annotations.1.key", "key_1"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "annotations.1.value", "test_value"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "annotations.#", "2"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "tags.0.key", "key_0"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "tags.0.value", "value_1"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "tags.1.key", "key_1"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "tags.1.value", "test_value"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "tags.#", "2"),
				),
			},
			// Update with children first child removed
			{
				Config:             testConfigPkiKeyRingChildrenRemoveOne + testConfigDataSourceSystem,
				ExpectNonEmptyPlan: false,
				Check: resource.ComposeAggregateTestCheckFunc(
					resource.TestCheckResourceAttr("aci_key_ring.test", "annotations.0.key", "key_1"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "annotations.0.value", "test_value"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "annotations.#", "1"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "tags.0.key", "key_1"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "tags.0.value", "test_value"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "tags.#", "1"),
				),
			},
			// Update with all children removed
			{
				Config:             testConfigPkiKeyRingChildrenRemoveAll + testConfigDataSourceSystem,
				ExpectNonEmptyPlan: false,
				Check: resource.ComposeAggregateTestCheckFunc(
					resource.TestCheckResourceAttr("aci_key_ring.test", "annotations.#", "0"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "tags.#", "0"),
				),
			},
		},
		CheckDestroy: testCheckResourceDestroy,
	})
}
func TestAccResourcePkiKeyRingWithFvTenant(t *testing.T) {

	resource.Test(t, resource.TestCase{
		PreCheck:                 func() { testAccPreCheck(t, "cloud", "1.0(1e)-") },
		ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
		Steps: []resource.TestStep{
			// Create with minimum config and verify default APIC values
			{
				Config:             testConfigPkiKeyRingMinDependencyWithFvTenantAllowExisting + testConfigDataSourceSystem,
				ExpectNonEmptyPlan: false,
				Check: resource.ComposeAggregateTestCheckFunc(
					resource.TestCheckResourceAttr("aci_key_ring.allow_test", "name", "test_name"),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test_2", "name", "test_name"),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test", "admin_state", "started"),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test_2", "admin_state", "started"),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test", "annotation", "orchestrator:terraform"),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test_2", "annotation", "orchestrator:terraform"),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test", "certificate", ""),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test_2", "certificate", ""),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test", "certificate_authority", ""),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test_2", "certificate_authority", ""),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test", "description", ""),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test_2", "description", ""),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test", "modulus", "mod2048"),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test_2", "modulus", "mod2048"),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test", "name_alias", ""),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test_2", "name_alias", ""),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test", "owner_key", ""),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test_2", "owner_key", ""),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test", "owner_tag", ""),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test_2", "owner_tag", ""),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test", "regenerate", "no"),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test_2", "regenerate", "no"),
					composeAggregateTestCheckFuncWithVersion(t, "6.0(2h)-", "inside",
						resource.TestCheckResourceAttr("aci_key_ring.allow_test", "elliptic_curve", "none"),
						resource.TestCheckResourceAttr("aci_key_ring.allow_test_2", "elliptic_curve", "none"),
						resource.TestCheckResourceAttr("aci_key_ring.allow_test", "key_type", "RSA"),
						resource.TestCheckResourceAttr("aci_key_ring.allow_test_2", "key_type", "RSA")),
				),
			},
		},
	})

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

	setEnvVariable(t, "ACI_ALLOW_EXISTING_ON_CREATE", "true")
	resource.Test(t, resource.TestCase{
		PreCheck:                 func() { testAccPreCheck(t, "cloud", "1.0(1e)-") },
		ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
		Steps: []resource.TestStep{
			// Create with minimum config and verify default APIC values
			{
				Config:             testConfigPkiKeyRingMinDependencyWithFvTenantAllowExisting + testConfigDataSourceSystem,
				ExpectNonEmptyPlan: false,
				Check: resource.ComposeAggregateTestCheckFunc(
					resource.TestCheckResourceAttr("aci_key_ring.allow_test", "name", "test_name"),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test_2", "name", "test_name"),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test", "admin_state", "started"),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test_2", "admin_state", "started"),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test", "annotation", "orchestrator:terraform"),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test_2", "annotation", "orchestrator:terraform"),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test", "certificate", ""),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test_2", "certificate", ""),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test", "certificate_authority", ""),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test_2", "certificate_authority", ""),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test", "description", ""),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test_2", "description", ""),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test", "modulus", "mod2048"),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test_2", "modulus", "mod2048"),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test", "name_alias", ""),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test_2", "name_alias", ""),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test", "owner_key", ""),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test_2", "owner_key", ""),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test", "owner_tag", ""),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test_2", "owner_tag", ""),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test", "regenerate", "no"),
					resource.TestCheckResourceAttr("aci_key_ring.allow_test_2", "regenerate", "no"),
					composeAggregateTestCheckFuncWithVersion(t, "6.0(2h)-", "inside",
						resource.TestCheckResourceAttr("aci_key_ring.allow_test", "elliptic_curve", "none"),
						resource.TestCheckResourceAttr("aci_key_ring.allow_test_2", "elliptic_curve", "none"),
						resource.TestCheckResourceAttr("aci_key_ring.allow_test", "key_type", "RSA"),
						resource.TestCheckResourceAttr("aci_key_ring.allow_test_2", "key_type", "RSA")),
				),
			},
		},
	})

	resource.Test(t, resource.TestCase{
		PreCheck:                 func() { testAccPreCheck(t, "cloud", "1.0(1e)-") },
		ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
		Steps: []resource.TestStep{
			// Create with minimum config and verify default APIC values
			{
				Config:             testConfigPkiKeyRingMinDependencyWithFvTenant + testConfigDataSourceSystem,
				ExpectNonEmptyPlan: false,
				Check: resource.ComposeAggregateTestCheckFunc(
					resource.TestCheckResourceAttr("aci_key_ring.test", "name", "test_name"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "admin_state", "started"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "annotation", "orchestrator:terraform"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "certificate", ""),
					resource.TestCheckResourceAttr("aci_key_ring.test", "certificate_authority", ""),
					resource.TestCheckResourceAttr("aci_key_ring.test", "description", ""),
					resource.TestCheckResourceAttr("aci_key_ring.test", "modulus", "mod2048"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "name_alias", ""),
					resource.TestCheckResourceAttr("aci_key_ring.test", "owner_key", ""),
					resource.TestCheckResourceAttr("aci_key_ring.test", "owner_tag", ""),
					resource.TestCheckResourceAttr("aci_key_ring.test", "regenerate", "no"),
					composeAggregateTestCheckFuncWithVersion(t, "6.0(2h)-", "inside",
						resource.TestCheckResourceAttr("aci_key_ring.test", "elliptic_curve", "none"),
						resource.TestCheckResourceAttr("aci_key_ring.test", "key_type", "RSA")),
				),
			},
			// Update with all config and verify default APIC values
			{
				Config:             testConfigPkiKeyRingAllDependencyWithFvTenant + testConfigDataSourceSystem,
				ExpectNonEmptyPlan: false,
				Check: resource.ComposeAggregateTestCheckFunc(
					resource.TestCheckResourceAttr("aci_key_ring.test", "name", "test_name"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "admin_state", "completed"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "annotation", "annotation"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "certificate", "-----BEGIN CERTIFICATE-----\nMIICODCCAaGgAwIBAgIJAIt8XMntue0VMA0GCSqGSIb3DQEBCwUAMDQxDjAMBgNV\nBAMMBUFkbWluMRUwEwYDVQQKDAxZb3VyIENvbXBhbnkxCzAJBgNVBAYTAlVTMCAX\nDTE4MDEwOTAwNTk0NFoYDzIxMTcxMjE2MDA1OTQ0WjA0MQ4wDAYDVQQDDAVBZG1p\nbjEVMBMGA1UECgwMWW91ciBDb21wYW55MQswCQYDVQQGEwJVUzCBnzANBgkqhkiG\n9w0BAQEFAAOBjQAwgYkCgYEAohG/7axtt7CbSaMP7r+2mhTKbNgh0Ww36C7Ta14i\nv+VmLyKkQHnXinKGhp6uy3Nug+15a+eIu7CrgpBVMQeCiWfsnwRocKcQJWIYDrWl\nXHxGQn31yYKR6mylE7Dcj3rMFybnyhezr5D8GcP85YRPmwG9H2hO/0Y1FUnWu9Iw\nAQkCAwEAAaNQME4wHQYDVR0OBBYEFD0jLXfpkrU/ChzRvfruRs/fy1VXMB8GA1Ud\nIwQYMBaAFD0jLXfpkrU/ChzRvfruRs/fy1VXMAwGA1UdEwQFMAMBAf8wDQYJKoZI\nhvcNAQELBQADgYEAOmvre+5tgZ0+F3DgsfxNQqLTrGiBgGCIymPkP/cBXXkNuJyl\n3ac7tArHQc7WEA4U2R2rZbEq8FC3UJJm4nUVtCPvEh3G9OhN2xwYev79yt6pIn/l\nKU0Td2OpVyo0eLqjoX5u2G90IBWzhyjFbo+CcKMrSVKj1YOdG0E3OuiJf00=\n-----END CERTIFICATE-----"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "certificate_authority", "test_name"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "description", "description_1"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "modulus", "mod1024"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "name_alias", "name_alias_1"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "owner_key", "owner_key_1"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "owner_tag", "owner_tag_1"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "regenerate", "no"),
					composeAggregateTestCheckFuncWithVersion(t, "6.0(2h)-", "inside",
						resource.TestCheckResourceAttr("aci_key_ring.test", "elliptic_curve", "none"),
						resource.TestCheckResourceAttr("aci_key_ring.test", "key_type", "RSA")),
				),
			},
			// Update with minimum config and verify config is unchanged
			{
				Config:             testConfigPkiKeyRingMinDependencyWithFvTenant + testConfigDataSourceSystem,
				ExpectNonEmptyPlan: false,
				Check: resource.ComposeAggregateTestCheckFunc(
					resource.TestCheckResourceAttr("aci_key_ring.test", "name", "test_name"),
				),
			},
			// Update with empty strings config or default value
			{
				Config:             testConfigPkiKeyRingResetDependencyWithFvTenant + testConfigDataSourceSystem,
				ExpectNonEmptyPlan: false,
				Check: resource.ComposeAggregateTestCheckFunc(
					resource.TestCheckResourceAttr("aci_key_ring.test", "name", "test_name"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "admin_state", "started"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "annotation", "orchestrator:terraform"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "certificate", ""),
					resource.TestCheckResourceAttr("aci_key_ring.test", "certificate_authority", ""),
					resource.TestCheckResourceAttr("aci_key_ring.test", "description", ""),
					resource.TestCheckResourceAttr("aci_key_ring.test", "modulus", "mod2048"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "name_alias", ""),
					resource.TestCheckResourceAttr("aci_key_ring.test", "owner_key", ""),
					resource.TestCheckResourceAttr("aci_key_ring.test", "owner_tag", ""),
					resource.TestCheckResourceAttr("aci_key_ring.test", "regenerate", "no"),
					composeAggregateTestCheckFuncWithVersion(t, "6.0(2h)-", "inside",
						resource.TestCheckResourceAttr("aci_key_ring.test", "elliptic_curve", "none"),
						resource.TestCheckResourceAttr("aci_key_ring.test", "key_type", "RSA")),
				),
			},
			// Import testing
			{
				ResourceName:            "aci_key_ring.test",
				ImportState:             true,
				ImportStateVerify:       true,
				ImportStateVerifyIgnore: []string{"key"},
			},
			// Update with children
			{
				Config:             testConfigPkiKeyRingChildrenDependencyWithFvTenant + testConfigDataSourceSystem,
				ExpectNonEmptyPlan: false,
				Check: resource.ComposeAggregateTestCheckFunc(
					resource.TestCheckResourceAttr("aci_key_ring.test", "name", "test_name"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "admin_state", "started"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "annotation", "orchestrator:terraform"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "certificate", ""),
					resource.TestCheckResourceAttr("aci_key_ring.test", "certificate_authority", ""),
					resource.TestCheckResourceAttr("aci_key_ring.test", "description", ""),
					resource.TestCheckResourceAttr("aci_key_ring.test", "modulus", "mod2048"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "name_alias", ""),
					resource.TestCheckResourceAttr("aci_key_ring.test", "owner_key", ""),
					resource.TestCheckResourceAttr("aci_key_ring.test", "owner_tag", ""),
					resource.TestCheckResourceAttr("aci_key_ring.test", "regenerate", "no"),
					composeAggregateTestCheckFuncWithVersion(t, "6.0(2h)-", "inside",
						resource.TestCheckResourceAttr("aci_key_ring.test", "elliptic_curve", "none"),
						resource.TestCheckResourceAttr("aci_key_ring.test", "key_type", "RSA")),
					resource.TestCheckResourceAttr("aci_key_ring.test", "annotations.0.key", "key_0"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "annotations.0.value", "value_1"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "annotations.1.key", "key_1"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "annotations.1.value", "test_value"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "tags.0.key", "key_0"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "tags.0.value", "value_1"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "tags.1.key", "key_1"),
					resource.TestCheckResourceAttr("aci_key_ring.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_key_ring.test",
				ImportState:             true,
				ImportStateVerify:       true,
				ImportStateVerifyIgnore: []string{"key"},
			},
			// Update with children removed from config
			{
				Config:             testConfigPkiKeyRingChildrenRemoveFromConfigDependencyWithFvTenant + testConfigDataSourceSystem,
				ExpectNonEmptyPlan: false,
				Check: resource.ComposeAggregateTestCheckFunc(
					resource.TestCheckResourceAttr("aci_key_ring.test", "annotations.0.key", "key_0"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "annotations.0.value", "value_1"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "annotations.1.key", "key_1"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "annotations.1.value", "test_value"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "annotations.#", "2"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "tags.0.key", "key_0"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "tags.0.value", "value_1"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "tags.1.key", "key_1"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "tags.1.value", "test_value"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "tags.#", "2"),
				),
			},
			// Update with children first child removed
			{
				Config:             testConfigPkiKeyRingChildrenRemoveOneDependencyWithFvTenant + testConfigDataSourceSystem,
				ExpectNonEmptyPlan: false,
				Check: resource.ComposeAggregateTestCheckFunc(
					resource.TestCheckResourceAttr("aci_key_ring.test", "annotations.0.key", "key_1"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "annotations.0.value", "test_value"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "annotations.#", "1"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "tags.0.key", "key_1"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "tags.0.value", "test_value"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "tags.#", "1"),
				),
			},
			// Update with all children removed
			{
				Config:             testConfigPkiKeyRingChildrenRemoveAllDependencyWithFvTenant + testConfigDataSourceSystem,
				ExpectNonEmptyPlan: false,
				Check: resource.ComposeAggregateTestCheckFunc(
					resource.TestCheckResourceAttr("aci_key_ring.test", "annotations.#", "0"),
					resource.TestCheckResourceAttr("aci_key_ring.test", "tags.#", "0"),
				),
			},
		},
		CheckDestroy: testCheckResourceDestroy,
	})
}

const testDependencyConfigPkiKeyRing = `
resource "aci_certificate_authority" "test_certificate_authority_0" {
  certificate_chain = "-----BEGIN CERTIFICATE-----\nMIICODCCAaGgAwIBAgIJAIt8XMntue0VMA0GCSqGSIb3DQEBCwUAMDQxDjAMBgNV\nBAMMBUFkbWluMRUwEwYDVQQKDAxZb3VyIENvbXBhbnkxCzAJBgNVBAYTAlVTMCAX\nDTE4MDEwOTAwNTk0NFoYDzIxMTcxMjE2MDA1OTQ0WjA0MQ4wDAYDVQQDDAVBZG1p\nbjEVMBMGA1UECgwMWW91ciBDb21wYW55MQswCQYDVQQGEwJVUzCBnzANBgkqhkiG\n9w0BAQEFAAOBjQAwgYkCgYEAohG/7axtt7CbSaMP7r+2mhTKbNgh0Ww36C7Ta14i\nv+VmLyKkQHnXinKGhp6uy3Nug+15a+eIu7CrgpBVMQeCiWfsnwRocKcQJWIYDrWl\nXHxGQn31yYKR6mylE7Dcj3rMFybnyhezr5D8GcP85YRPmwG9H2hO/0Y1FUnWu9Iw\nAQkCAwEAAaNQME4wHQYDVR0OBBYEFD0jLXfpkrU/ChzRvfruRs/fy1VXMB8GA1Ud\nIwQYMBaAFD0jLXfpkrU/ChzRvfruRs/fy1VXMAwGA1UdEwQFMAMBAf8wDQYJKoZI\nhvcNAQELBQADgYEAOmvre+5tgZ0+F3DgsfxNQqLTrGiBgGCIymPkP/cBXXkNuJyl\n3ac7tArHQc7WEA4U2R2rZbEq8FC3UJJm4nUVtCPvEh3G9OhN2xwYev79yt6pIn/l\nKU0Td2OpVyo0eLqjoX5u2G90IBWzhyjFbo+CcKMrSVKj1YOdG0E3OuiJf00=\n-----END CERTIFICATE-----"
  name = "test_name"
}
`

const testConfigPkiKeyRingMinAllowExisting = testDependencyConfigPkiKeyRing + `
resource "aci_key_ring" "allow_test" {
  name = "test_name"
}
resource "aci_key_ring" "allow_test_2" {
  name = "test_name"
  depends_on = [aci_key_ring.allow_test]
}
`

const testConfigPkiKeyRingMin = testDependencyConfigPkiKeyRing + `
resource "aci_key_ring" "test" {
  name = "test_name"
}
`

const testConfigPkiKeyRingAll = testDependencyConfigPkiKeyRing + `
resource "aci_key_ring" "test" {
  name = "test_name"
  admin_state = "completed"
  annotation = "annotation"
  certificate = "-----BEGIN CERTIFICATE-----\nMIICODCCAaGgAwIBAgIJAIt8XMntue0VMA0GCSqGSIb3DQEBCwUAMDQxDjAMBgNV\nBAMMBUFkbWluMRUwEwYDVQQKDAxZb3VyIENvbXBhbnkxCzAJBgNVBAYTAlVTMCAX\nDTE4MDEwOTAwNTk0NFoYDzIxMTcxMjE2MDA1OTQ0WjA0MQ4wDAYDVQQDDAVBZG1p\nbjEVMBMGA1UECgwMWW91ciBDb21wYW55MQswCQYDVQQGEwJVUzCBnzANBgkqhkiG\n9w0BAQEFAAOBjQAwgYkCgYEAohG/7axtt7CbSaMP7r+2mhTKbNgh0Ww36C7Ta14i\nv+VmLyKkQHnXinKGhp6uy3Nug+15a+eIu7CrgpBVMQeCiWfsnwRocKcQJWIYDrWl\nXHxGQn31yYKR6mylE7Dcj3rMFybnyhezr5D8GcP85YRPmwG9H2hO/0Y1FUnWu9Iw\nAQkCAwEAAaNQME4wHQYDVR0OBBYEFD0jLXfpkrU/ChzRvfruRs/fy1VXMB8GA1Ud\nIwQYMBaAFD0jLXfpkrU/ChzRvfruRs/fy1VXMAwGA1UdEwQFMAMBAf8wDQYJKoZI\nhvcNAQELBQADgYEAOmvre+5tgZ0+F3DgsfxNQqLTrGiBgGCIymPkP/cBXXkNuJyl\n3ac7tArHQc7WEA4U2R2rZbEq8FC3UJJm4nUVtCPvEh3G9OhN2xwYev79yt6pIn/l\nKU0Td2OpVyo0eLqjoX5u2G90IBWzhyjFbo+CcKMrSVKj1YOdG0E3OuiJf00=\n-----END CERTIFICATE-----"
  certificate_authority = "test_name"
  description = "description_1"
  key = "-----BEGIN PRIVATE KEY-----\nMIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAKIRv+2sbbewm0mj\nD+6/tpoUymzYIdFsN+gu02teIr/lZi8ipEB514pyhoaerstzboPteWvniLuwq4KQ\nVTEHgoln7J8EaHCnECViGA61pVx8RkJ99cmCkepspROw3I96zBcm58oXs6+Q/BnD\n/OWET5sBvR9oTv9GNRVJ1rvSMAEJAgMBAAECgYByu3QO0qF9h7X3JEu0Ld4cKBnB\ngiQ2uJC/et7KxIJ/LOvw9GopBthyt27KwG1ntBkJpkTuAaQHkyNns7vLkNB0S0IR\n+owVFEcKYq9VCHTaiQU8TDp24gN+yPTrpRuH8YhDVq5SfVdVuTMgHVQdj4ya4VlF\nGj+a7+ipxtGiLsVGrQJBAM7p0Fm0xmzi+tBOASUAcVrPLcteFIaTBFwfq16dm/ON\n00Khla8Et5kMBttTbqbukl8mxFjBEEBlhQqb6EdQQ0sCQQDIhHx1a9diG7y/4DQA\n4KvR3FCYwP8PBORlSamegzCo+P1OzxiEo0amX7yQMA5UyiP/kUsZrme2JBZgna8S\np4R7AkEAr7rMhSOPUnMD6V4WgsJ5g1Jp5kqkzBaYoVUUSms5RASz4+cwJVCwTX91\nY1jcpVIBZmaaY3a0wrx13ajEAa0dOQJBAIpjnb4wqpsEh7VpmJqOdSdGxb1XXfFQ\nsA0T1OQYqQnFppWwqrxIL+d9pZdiA1ITnNqyvUFBNETqDSOrUHwwb2cCQGArE+vu\nffPUWQ0j+fiK+covFG8NL7H+26NSGB5+Xsn9uwOGLj7K/YT6CbBtr9hJiuWjM1Al\n0V4ltlTuu2mTMaw=\n-----END PRIVATE KEY-----"
  modulus = "mod1024"
  name_alias = "name_alias_1"
  owner_key = "owner_key_1"
  owner_tag = "owner_tag_1"
  regenerate = "no"
  elliptic_curve = provider::aci::compare_versions(data.aci_system.version.version,"inside","6.0(2h)-") ? "none" : null
  key_type = provider::aci::compare_versions(data.aci_system.version.version,"inside","6.0(2h)-") ? "RSA" : null
}
`

const testConfigPkiKeyRingReset = testDependencyConfigPkiKeyRing + `
resource "aci_key_ring" "test" {
  name = "test_name"
  admin_state = "started"
  annotation = "orchestrator:terraform"
  certificate = ""
  certificate_authority = ""
  description = ""
  key = ""
  modulus = "mod2048"
  name_alias = ""
  owner_key = ""
  owner_tag = ""
  regenerate = "no"
  elliptic_curve = provider::aci::compare_versions(data.aci_system.version.version,"inside","6.0(2h)-") ? "none" : null
  key_type = provider::aci::compare_versions(data.aci_system.version.version,"inside","6.0(2h)-") ? "RSA" : null
}
`
const testConfigPkiKeyRingChildren = testDependencyConfigPkiKeyRing + `
resource "aci_key_ring" "test" {
  name = "test_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"
    },
  ]
}
`

const testConfigPkiKeyRingChildrenRemoveFromConfig = testDependencyConfigPkiKeyRing + `
resource "aci_key_ring" "test" {
  name = "test_name"
}
`

const testConfigPkiKeyRingChildrenRemoveOne = testDependencyConfigPkiKeyRing + `
resource "aci_key_ring" "test" {
  name = "test_name"
  annotations = [ 
	{
	  key = "key_1"
	  value = "test_value"
	},
  ]
  tags = [ 
	{
	  key = "key_1"
	  value = "test_value"
	},
  ]
}
`

const testConfigPkiKeyRingChildrenRemoveAll = testDependencyConfigPkiKeyRing + `
resource "aci_key_ring" "test" {
  name = "test_name"
  annotations = []
  tags = []
}
`

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

const testConfigPkiKeyRingMinDependencyWithFvTenant = testDependencyConfigPkiKeyRing + testConfigFvTenantMin + `
resource "aci_key_ring" "test" {
  parent_dn = aci_tenant.test.id
  name = "test_name"
}
`

const testConfigPkiKeyRingAllDependencyWithFvTenant = testDependencyConfigPkiKeyRing + testConfigFvTenantMin + `
resource "aci_key_ring" "test" {
  parent_dn = aci_tenant.test.id
  name = "test_name"
  admin_state = "completed"
  annotation = "annotation"
  certificate = "-----BEGIN CERTIFICATE-----\nMIICODCCAaGgAwIBAgIJAIt8XMntue0VMA0GCSqGSIb3DQEBCwUAMDQxDjAMBgNV\nBAMMBUFkbWluMRUwEwYDVQQKDAxZb3VyIENvbXBhbnkxCzAJBgNVBAYTAlVTMCAX\nDTE4MDEwOTAwNTk0NFoYDzIxMTcxMjE2MDA1OTQ0WjA0MQ4wDAYDVQQDDAVBZG1p\nbjEVMBMGA1UECgwMWW91ciBDb21wYW55MQswCQYDVQQGEwJVUzCBnzANBgkqhkiG\n9w0BAQEFAAOBjQAwgYkCgYEAohG/7axtt7CbSaMP7r+2mhTKbNgh0Ww36C7Ta14i\nv+VmLyKkQHnXinKGhp6uy3Nug+15a+eIu7CrgpBVMQeCiWfsnwRocKcQJWIYDrWl\nXHxGQn31yYKR6mylE7Dcj3rMFybnyhezr5D8GcP85YRPmwG9H2hO/0Y1FUnWu9Iw\nAQkCAwEAAaNQME4wHQYDVR0OBBYEFD0jLXfpkrU/ChzRvfruRs/fy1VXMB8GA1Ud\nIwQYMBaAFD0jLXfpkrU/ChzRvfruRs/fy1VXMAwGA1UdEwQFMAMBAf8wDQYJKoZI\nhvcNAQELBQADgYEAOmvre+5tgZ0+F3DgsfxNQqLTrGiBgGCIymPkP/cBXXkNuJyl\n3ac7tArHQc7WEA4U2R2rZbEq8FC3UJJm4nUVtCPvEh3G9OhN2xwYev79yt6pIn/l\nKU0Td2OpVyo0eLqjoX5u2G90IBWzhyjFbo+CcKMrSVKj1YOdG0E3OuiJf00=\n-----END CERTIFICATE-----"
  certificate_authority = "test_name"
  description = "description_1"
  key = "-----BEGIN PRIVATE KEY-----\nMIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAKIRv+2sbbewm0mj\nD+6/tpoUymzYIdFsN+gu02teIr/lZi8ipEB514pyhoaerstzboPteWvniLuwq4KQ\nVTEHgoln7J8EaHCnECViGA61pVx8RkJ99cmCkepspROw3I96zBcm58oXs6+Q/BnD\n/OWET5sBvR9oTv9GNRVJ1rvSMAEJAgMBAAECgYByu3QO0qF9h7X3JEu0Ld4cKBnB\ngiQ2uJC/et7KxIJ/LOvw9GopBthyt27KwG1ntBkJpkTuAaQHkyNns7vLkNB0S0IR\n+owVFEcKYq9VCHTaiQU8TDp24gN+yPTrpRuH8YhDVq5SfVdVuTMgHVQdj4ya4VlF\nGj+a7+ipxtGiLsVGrQJBAM7p0Fm0xmzi+tBOASUAcVrPLcteFIaTBFwfq16dm/ON\n00Khla8Et5kMBttTbqbukl8mxFjBEEBlhQqb6EdQQ0sCQQDIhHx1a9diG7y/4DQA\n4KvR3FCYwP8PBORlSamegzCo+P1OzxiEo0amX7yQMA5UyiP/kUsZrme2JBZgna8S\np4R7AkEAr7rMhSOPUnMD6V4WgsJ5g1Jp5kqkzBaYoVUUSms5RASz4+cwJVCwTX91\nY1jcpVIBZmaaY3a0wrx13ajEAa0dOQJBAIpjnb4wqpsEh7VpmJqOdSdGxb1XXfFQ\nsA0T1OQYqQnFppWwqrxIL+d9pZdiA1ITnNqyvUFBNETqDSOrUHwwb2cCQGArE+vu\nffPUWQ0j+fiK+covFG8NL7H+26NSGB5+Xsn9uwOGLj7K/YT6CbBtr9hJiuWjM1Al\n0V4ltlTuu2mTMaw=\n-----END PRIVATE KEY-----"
  modulus = "mod1024"
  name_alias = "name_alias_1"
  owner_key = "owner_key_1"
  owner_tag = "owner_tag_1"
  regenerate = "no"
  elliptic_curve = provider::aci::compare_versions(data.aci_system.version.version,"inside","6.0(2h)-") ? "none" : null
  key_type = provider::aci::compare_versions(data.aci_system.version.version,"inside","6.0(2h)-") ? "RSA" : null
}
`

const testConfigPkiKeyRingResetDependencyWithFvTenant = testDependencyConfigPkiKeyRing + testConfigFvTenantMin + `
resource "aci_key_ring" "test" {
  parent_dn = aci_tenant.test.id
  name = "test_name"
  admin_state = "started"
  annotation = "orchestrator:terraform"
  certificate = ""
  certificate_authority = ""
  description = ""
  key = ""
  modulus = "mod2048"
  name_alias = ""
  owner_key = ""
  owner_tag = ""
  regenerate = "no"
  elliptic_curve = provider::aci::compare_versions(data.aci_system.version.version,"inside","6.0(2h)-") ? "none" : null
  key_type = provider::aci::compare_versions(data.aci_system.version.version,"inside","6.0(2h)-") ? "RSA" : null
}
`
const testConfigPkiKeyRingChildrenDependencyWithFvTenant = testDependencyConfigPkiKeyRing + testConfigFvTenantMin + `
resource "aci_key_ring" "test" {
  parent_dn = aci_tenant.test.id
  name = "test_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"
    },
  ]
}
`

const testConfigPkiKeyRingChildrenRemoveFromConfigDependencyWithFvTenant = testDependencyConfigPkiKeyRing + testConfigFvTenantMin + `
resource "aci_key_ring" "test" {
  parent_dn = aci_tenant.test.id
  name = "test_name"
}
`

const testConfigPkiKeyRingChildrenRemoveOneDependencyWithFvTenant = testDependencyConfigPkiKeyRing + testConfigFvTenantMin + `
resource "aci_key_ring" "test" {
  parent_dn = aci_tenant.test.id
  name = "test_name"
  annotations = [ 
	{
	  key = "key_1"
	  value = "test_value"
	},
  ]
  tags = [ 
	{
	  key = "key_1"
	  value = "test_value"
	},
  ]
}
`

const testConfigPkiKeyRingChildrenRemoveAllDependencyWithFvTenant = testDependencyConfigPkiKeyRing + testConfigFvTenantMin + `
resource "aci_key_ring" "test" {
  parent_dn = aci_tenant.test.id
  name = "test_name"
  annotations = []
  tags = []
}
`
