Skip to content

Commit

Permalink
Revert "add dns keys datasource (hashicorp#7186) (hashicorp#5179)"
Browse files Browse the repository at this point in the history
This reverts commit 0680a77.
  • Loading branch information
rileykarson committed Feb 14, 2023
1 parent 9e3f066 commit 63f1888
Show file tree
Hide file tree
Showing 6 changed files with 168 additions and 455 deletions.
3 changes: 0 additions & 3 deletions .changelog/7186.txt

This file was deleted.

44 changes: 8 additions & 36 deletions google-beta/data_source_dns_key_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,41 +11,21 @@ import (
func TestAccDataSourceDNSKeys_basic(t *testing.T) {
t.Parallel()

dnsZoneName := fmt.Sprintf("tf-dnskey-test-%s", randString(t, 10))

var kskDigest1, kskDigest2, zskPubKey1, zskPubKey2, kskAlg1, kskAlg2 string
dnsZoneName := fmt.Sprintf("data-dnskey-test-%s", randString(t, 10))

vcrTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
CheckDestroy: testAccCheckDNSManagedZoneDestroyProducerFramework(t),
Providers: testAccProviders,
CheckDestroy: testAccCheckDNSManagedZoneDestroyProducer(t),
Steps: []resource.TestStep{
{
ExternalProviders: providerVersion450(),
Config: testAccDataSourceDNSKeysConfig(dnsZoneName, "on"),
Config: testAccDataSourceDNSKeysConfig(dnsZoneName, "on"),
Check: resource.ComposeTestCheckFunc(
testAccDataSourceDNSKeysDSRecordCheck("data.google_dns_keys.foo_dns_key"),
resource.TestCheckResourceAttr("data.google_dns_keys.foo_dns_key", "key_signing_keys.#", "1"),
resource.TestCheckResourceAttr("data.google_dns_keys.foo_dns_key", "zone_signing_keys.#", "1"),
resource.TestCheckResourceAttr("data.google_dns_keys.foo_dns_key_id", "key_signing_keys.#", "1"),
resource.TestCheckResourceAttr("data.google_dns_keys.foo_dns_key_id", "zone_signing_keys.#", "1"),
testExtractResourceAttr("data.google_dns_keys.foo_dns_key", "key_signing_keys.0.digests.0.digest", &kskDigest1),
testExtractResourceAttr("data.google_dns_keys.foo_dns_key_id", "zone_signing_keys.0.public_key", &zskPubKey1),
testExtractResourceAttr("data.google_dns_keys.foo_dns_key_id", "key_signing_keys.0.algorithm", &kskAlg1),
),
},
{
ProtoV5ProviderFactories: protoV5ProviderFactories(t),
Config: testAccDataSourceDNSKeysConfig(dnsZoneName, "on"),
Check: resource.ComposeTestCheckFunc(
testAccDataSourceDNSKeysDSRecordCheck("data.google_dns_keys.foo_dns_key"),
resource.TestCheckResourceAttr("data.google_dns_keys.foo_dns_key", "key_signing_keys.#", "1"),
resource.TestCheckResourceAttr("data.google_dns_keys.foo_dns_key", "zone_signing_keys.#", "1"),
testExtractResourceAttr("data.google_dns_keys.foo_dns_key", "key_signing_keys.0.digests.0.digest", &kskDigest2),
testExtractResourceAttr("data.google_dns_keys.foo_dns_key_id", "zone_signing_keys.0.public_key", &zskPubKey2),
testExtractResourceAttr("data.google_dns_keys.foo_dns_key_id", "key_signing_keys.0.algorithm", &kskAlg2),
testCheckAttributeValuesEqual(&kskDigest1, &kskDigest2),
testCheckAttributeValuesEqual(&zskPubKey1, &zskPubKey2),
testCheckAttributeValuesEqual(&kskAlg1, &kskAlg2),
),
},
},
Expand All @@ -55,23 +35,15 @@ func TestAccDataSourceDNSKeys_basic(t *testing.T) {
func TestAccDataSourceDNSKeys_noDnsSec(t *testing.T) {
t.Parallel()

dnsZoneName := fmt.Sprintf("tf-dnskey-test-%s", randString(t, 10))
dnsZoneName := fmt.Sprintf("data-dnskey-test-%s", randString(t, 10))

vcrTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
CheckDestroy: testAccCheckDNSManagedZoneDestroyProducerFramework(t),
Providers: testAccProviders,
CheckDestroy: testAccCheckDNSManagedZoneDestroyProducer(t),
Steps: []resource.TestStep{
{
ExternalProviders: providerVersion450(),
Config: testAccDataSourceDNSKeysConfig(dnsZoneName, "off"),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("data.google_dns_keys.foo_dns_key", "key_signing_keys.#", "0"),
resource.TestCheckResourceAttr("data.google_dns_keys.foo_dns_key", "zone_signing_keys.#", "0"),
),
},
{
ProtoV5ProviderFactories: protoV5ProviderFactories(t),
Config: testAccDataSourceDNSKeysConfig(dnsZoneName, "off"),
Config: testAccDataSourceDNSKeysConfig(dnsZoneName, "off"),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("data.google_dns_keys.foo_dns_key", "key_signing_keys.#", "0"),
resource.TestCheckResourceAttr("data.google_dns_keys.foo_dns_key", "zone_signing_keys.#", "0"),
Expand Down
Loading

0 comments on commit 63f1888

Please sign in to comment.