Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ManagedZone.yaml and add domain name to forwarding config and make ipv4Address optional #13182

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion mmv1/products/dns/ManagedZone.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,10 @@ properties:
- name: 'ipv4Address'
type: String
description: 'IPv4 address of a target name server.'
required: true
- name: 'domainName'
type: String
description: 'Fully qualified domain name for the forwarding target.'
min_version: 'beta'
- name: 'forwardingPath'
type: Enum
description: |
Expand All @@ -365,6 +368,9 @@ properties:
enum_values:
- 'default'
- 'private'
exactly_one_of:
- 'ipv4_address'
- 'domain_name'
- name: 'peeringConfig'
type: NestedObject
description: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,70 @@ resource "google_dns_managed_zone" "foobar" {
}

{{ if not (or (eq $.TargetVersionName ``) (eq $.TargetVersionName `ga`)) }}
func TestAccDNSManagedZone_privateForwardingWithDomainNameUpdate(t *testing.T) {
t.Parallel()

zoneSuffix := acctest.RandString(t, 10)

acctest.VcrTest(t, resource.TestCase{
PreCheck: func() { acctest.AccTestPreCheck(t) },
ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t),
CheckDestroy: testAccCheckDNSManagedZoneDestroyProducer(t),
Steps: []resource.TestStep{
{
Config: testAccDnsManagedZone_privateForwardingWithDomainNameUpdate(zoneSuffix, "172.16.1.10", "dns.infra.foo.com.", "private", "default"),
},
{
ResourceName: "google_dns_managed_zone.private",
ImportState: true,
ImportStateVerify: true,
},
{
Config: testAccDnsManagedZone_privateForwardingWithDomainNameUpdate(zoneSuffix, "172.16.1.10", "dns.infra.goo.com.", "default", "private"),
},
{
ResourceName: "google_dns_managed_zone.private",
ImportState: true,
ImportStateVerify: true,
},
},
})
}

func testAccDnsManagedZone_privateForwardingWithDomainNameUpdate(suffix, first_nameserver, domain_name, first_forwarding_path, second_forwarding_path string) string {
return fmt.Sprintf(`
resource "google_dns_managed_zone" "private" {
provider = google-beta
name = "private-zone-%s"
dns_name = "private.example.com."
description = "Example private DNS zone"
visibility = "private"
private_visibility_config {
networks {
network_url = google_compute_network.network-1.self_link
}
}

forwarding_config {
target_name_servers {
ipv4_address = "%s"
forwarding_path = "%s"
}
target_name_servers {
domain_name = "%s"
forwarding_path = "%s"
}
}
}

resource "google_compute_network" "network-1" {
provider = google-beta
name = "tf-test-net-1-%s"
auto_create_subnetworks = false
}
`, suffix, first_nameserver, first_forwarding_path, domain_name, second_forwarding_path, suffix)
}

func TestAccDNSManagedZone_dnsManagedZoneUpdateWithServiceDirectory(t *testing.T) {
t.Parallel()

Expand Down Expand Up @@ -770,4 +834,4 @@ resource "google_compute_network" "network" {
}
`, context)
}
{{- end }}
{{- end }}
Loading