blob: a38620623cabeff395072d22cc41ec2f696c9080 [file] [log] [blame]
---
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** Type: MMv1 ***
#
# ----------------------------------------------------------------------------
#
# This file is automatically generated by Magic Modules and manual
# changes will be clobbered when the file is regenerated.
#
# Please read more about how to change this file in
# .github/CONTRIBUTING.md.
#
# ----------------------------------------------------------------------------
subcategory: "Cloud DNS"
description: |-
A Response Policy Rule is a selector that applies its behavior to queries that match the selector.
---
# 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.
<div class = "oics-button" style="float: right; margin: 0 0 -15px">
<a href="https://console.cloud.google.com/cloudshell/open?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2Fterraform-google-modules%2Fdocs-examples.git&cloudshell_working_dir=dns_response_policy_rule_basic&cloudshell_image=gcr.io%2Fcloudshell-images%2Fcloudshell%3Alatest&open_in_editor=main.tf&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md" target="_blank">
<img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;">
</a>
</div>
## Example Usage - Dns Response Policy Rule Basic
```hcl
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:
* `rule_name` -
(Required)
An identifier for this rule. Must be unique with the ResponsePolicy.
* `dns_name` -
(Required)
The DNS name (wildcard or exact) to apply this rule to. Must be unique within the Response Policy Rule.
* `response_policy` -
(Required)
Identifies the response policy addressed by this request.
- - -
* `local_data` -
(Optional)
Answer this query directly with DNS data. These ResourceRecordSets override any other DNS behavior for the matched name;
in particular they override private zones, the public internet, and GCP internal DNS. No SOA nor NS types are allowed.
Structure is [documented below](#nested_local_data).
* `behavior` -
(Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html))
Answer this query with a behavior rather than DNS data. Acceptable values are 'behaviorUnspecified', and 'bypassResponsePolicy'
* `project` - (Optional) The ID of the project in which the resource belongs.
If it is not provided, the provider project is used.
<a name="nested_local_data"></a>The `local_data` block supports:
* `local_datas` -
(Required)
All resource record sets for this selector, one per resource record type. The name must match the dns_name.
Structure is [documented below](#nested_local_datas).
<a name="nested_local_datas"></a>The `local_datas` block supports:
* `name` -
(Required)
For example, www.example.com.
* `type` -
(Required)
One of valid DNS resource types.
Possible values are: `A`, `AAAA`, `CAA`, `CNAME`, `DNSKEY`, `DS`, `HTTPS`, `IPSECVPNKEY`, `MX`, `NAPTR`, `NS`, `PTR`, `SOA`, `SPF`, `SRV`, `SSHFP`, `SVCB`, `TLSA`, `TXT`.
* `ttl` -
(Optional)
Number of seconds that this ResourceRecordSet can be cached by
resolvers.
* `rrdatas` -
(Optional)
As defined in RFC 1035 (section 5) and RFC 1034 (section 3.6.1)
## Attributes Reference
In addition to the arguments listed above, the following computed attributes are exported:
* `id` - an identifier for the resource with format `projects/{{project}}/responsePolicies/{{response_policy}}/rules/{{rule_name}}`
## Timeouts
This resource provides the following
[Timeouts](https://developer.hashicorp.com/terraform/plugin/sdkv2/resources/retries-and-customizable-timeouts) configuration options:
- `create` - Default is 20 minutes.
- `update` - Default is 20 minutes.
- `delete` - Default is 20 minutes.
## Import
ResponsePolicyRule can be imported using any of these accepted formats:
* `projects/{{project}}/responsePolicies/{{response_policy}}/rules/{{rule_name}}`
* `{{project}}/{{response_policy}}/{{rule_name}}`
* `{{response_policy}}/{{rule_name}}`
In Terraform v1.5.0 and later, use an [`import` block](https://developer.hashicorp.com/terraform/language/import) to import ResponsePolicyRule using one of the formats above. For example:
```tf
import {
id = "projects/{{project}}/responsePolicies/{{response_policy}}/rules/{{rule_name}}"
to = google_dns_response_policy_rule.default
}
```
When using the [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import), 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](https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/provider_reference#user_project_override).