Skip to content

Add Terraform support for configuring NAT64 for public Router NAT #22116

Closed
@matheusaleixo-cit

Description

@matheusaleixo-cit

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request.
  • Please do not leave +1 or me too comments, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.
  • If an issue is assigned to a user, that user is claiming responsibility for the issue.
  • Customers working with a Google Technical Account Manager or Customer Engineer can ask them to reach out internally to expedite investigation and resolution of this issue.

Description

Add support for configuring public Router NAT services with NAT64 enabled, as well as support for DNS64 configuration for dns policies.
Those features are currently available for preview in the beta API.

New or Affected Resource(s)

  • google_compute_router_nat
  • google_dns_policy

Potential Terraform Configuration

resource "google_dns_policy" "example-policy" {
  name = "tf-test-example-policy-%{random_suffix}"
  description = "Test DNS64 Policy."

  enable_inbound_forwarding = false
  enable_logging = false

  dns64_config {         # <-- New field
    scope {
      all_queries = true
    }
  }

  networks {
    network_url = google_compute_network.network-1.id
  }
  networks {
    network_url = google_compute_network.network-2.id
  }
}

resource "google_compute_router_nat" "foobar" {
  name                               = "tf-test-router-nat-%{random_suffix}"
  router                             = google_compute_router.foobar.name
  region                             = google_compute_router.foobar.region
  nat_ip_allocate_option             = "AUTO_ONLY"

  source_subnetwork_ip_ranges_to_nat = "ALL_SUBNETWORKS_ALL_IP_RANGES"
  source_subnetwork_ip_ranges_to_nat64 = "ALL_IPV6_SUBNETWORKS"        # <-- New field

  log_config {
    enable = true
    filter = "ERRORS_ONLY"
  }
}

References

Compute Router API: https://cloud.google.com/compute/docs/reference/rest/beta/routers#:~:text=nats%5B%5D.sourceSubnetworkIpRangesToNat64

DNS Policy API (still does not list the dns64Config field, despite it being used in requests when using the gcloud create command and being listed in the discovery docs): https://cloud.google.com/dns/docs/reference/rest/v1beta2/policies

Docs:

b/407117084
b/407117564

Metadata

Metadata

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions