google_dns_response_policy_rule

A Response Policy Rule is a selector that applies its behavior to queries that match the selector. Selectors are DNS names, which may be wildcards or exact matches. Each DNS query subject to a Response Policy matches at most one ResponsePolicyRule, as identified by the dns_name field with the longest matching suffix.

Open in Cloud Shell

Example Usage - Dns Response Policy Rule Basic

resource "google_compute_network" "network-1" {
  name                    = "network-1"
  auto_create_subnetworks = false
}

resource "google_compute_network" "network-2" {
  name                    = "network-2"
  auto_create_subnetworks = false
}

resource "google_dns_response_policy" "response-policy" {
  response_policy_name = "example-response-policy"

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

resource "google_dns_response_policy_rule" "example-response-policy-rule" {
  response_policy = google_dns_response_policy.response-policy.response_policy_name
  rule_name       = "example-rule"
  dns_name        = "dns.example.com."

  local_data {
    local_datas {
      name    = "dns.example.com."
      type    = "A"
      ttl     = 300
      rrdatas = ["192.0.2.91"]
    }
  }

}

Argument Reference

The following arguments are supported:


The local_data block supports:

The local_datas block supports:

Attributes Reference

In addition to the arguments listed above, the following computed attributes are exported:

Timeouts

This resource provides the following Timeouts configuration options:

Import

ResponsePolicyRule can be imported using any of these accepted formats:

In Terraform v1.5.0 and later, use an import block to import ResponsePolicyRule using one of the formats above. For example:

import {
  id = "projects/{{project}}/responsePolicies/{{response_policy}}/rules/{{rule_name}}"
  to = google_dns_response_policy_rule.default
}

When using the terraform import command, ResponsePolicyRule can be imported using one of the formats above. For example:

$ terraform import google_dns_response_policy_rule.default projects/{{project}}/responsePolicies/{{response_policy}}/rules/{{rule_name}}
$ terraform import google_dns_response_policy_rule.default {{project}}/{{response_policy}}/{{rule_name}}
$ terraform import google_dns_response_policy_rule.default {{response_policy}}/{{rule_name}}

User Project Overrides

This resource supports User Project Overrides.