Skip to content

Resource: awsRoute53ResolverRule

Provides a Route53 Resolver rule.

Example Usage

System rule

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.route53ResolverRule.Route53ResolverRule(this, "sys", {
  domainName: "subdomain.example.com",
  ruleType: "SYSTEM",
});

Forward rule

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.route53ResolverRule.Route53ResolverRule(this, "fwd", {
  domainName: "example.com",
  name: "example",
  resolverEndpointId: "${aws_route53_resolver_endpoint.foo.id}",
  ruleType: "FORWARD",
  tags: {
    Environment: "Prod",
  },
  targetIp: [
    {
      ip: "123.45.67.89",
    },
  ],
});

Argument Reference

The following arguments are supported:

  • domainName - (Required) DNS queries for this domain name are forwarded to the IP addresses that are specified using targetIp.
  • ruleType - (Required) The rule type. Valid values are forward, system and recursive.
  • name - (Optional) A friendly name that lets you easily find a rule in the Resolver dashboard in the Route 53 console.
  • resolverEndpointId (Optional) The ID of the outbound resolver endpoint that you want to use to route DNS queries to the IP addresses that you specify using targetIp. This argument should only be specified for forward type rules.
  • targetIp - (Optional) Configuration block(s) indicating the IPs that you want Resolver to forward DNS queries to (documented below). This argument should only be specified for forward type rules.
  • tags - (Optional) A map of tags to assign to the resource. If configured with a provider defaultTags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

The targetIp object supports the following:

  • ip - (Required) One IP address that you want to forward DNS queries to. You can specify only IPv4 addresses.
  • port - (Optional) The port at ip that you want to forward DNS queries to. Default value is 53

Attributes Reference

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

  • id - The ID of the resolver rule.
  • arn - The ARN (Amazon Resource Name) for the resolver rule.
  • ownerId - When a rule is shared with another AWS account, the account ID of the account that the rule is shared with.
  • shareStatus - Whether the rules is shared and, if so, whether the current account is sharing the rule with another account, or another account is sharing the rule with the current account. Values are NOT_SHARED, SHARED_BY_ME or SHARED_WITH_ME
  • tagsAll - A map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.

Import

Route53 Resolver rules can be imported using the id, e.g.,

$ terraform import aws_route53_resolver_rule.sys rslvr-rr-0123456789abcdef0