Skip to content

Resource: awsRoute53ResolverFirewallRule

Provides a Route 53 Resolver DNS Firewall rule resource.

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
const awsRoute53ResolverFirewallDomainListExample =
  new aws.route53ResolverFirewallDomainList.Route53ResolverFirewallDomainList(
    this,
    "example",
    {
      domains: ["example.com"],
      name: "example",
      tags: {},
    }
  );
const awsRoute53ResolverFirewallRuleGroupExample =
  new aws.route53ResolverFirewallRuleGroup.Route53ResolverFirewallRuleGroup(
    this,
    "example_1",
    {
      name: "example",
      tags: {},
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsRoute53ResolverFirewallRuleGroupExample.overrideLogicalId("example");
const awsRoute53ResolverFirewallRuleExample =
  new aws.route53ResolverFirewallRule.Route53ResolverFirewallRule(
    this,
    "example_2",
    {
      action: "BLOCK",
      blockOverrideDnsType: "CNAME",
      blockOverrideDomain: "example.com",
      blockOverrideTtl: 1,
      blockResponse: "OVERRIDE",
      firewallDomainListId: awsRoute53ResolverFirewallDomainListExample.id,
      firewallRuleGroupId: awsRoute53ResolverFirewallRuleGroupExample.id,
      name: "example",
      priority: 100,
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsRoute53ResolverFirewallRuleExample.overrideLogicalId("example");

Argument Reference

The following argument is supported:

  • name - (Required) A name that lets you identify the rule, to manage and use it.
  • action - (Required) The action that DNS Firewall should take on a DNS query when it matches one of the domains in the rule's domain list. Valid values: allow, block, alert.
  • blockOverrideDnsType - (Required if blockResponse is override) The DNS record's type. This determines the format of the record value that you provided in BlockOverrideDomain. Value values: cname.
  • blockOverrideDomain - (Required if blockResponse is override) The custom DNS record to send back in response to the query.
  • blockOverrideTtl - (Required if blockResponse is override) The recommended amount of time, in seconds, for the DNS resolver or web browser to cache the provided override record. Minimum value of 0. Maximum value of 604800.
  • blockResponse - (Required if action is block) The way that you want DNS Firewall to block the request. Valid values: nodata, nxdomain, override.
  • firewallDomainListId - (Required) The ID of the domain list that you want to use in the rule.
  • firewallRuleGroupId - (Required) The unique identifier of the firewall rule group where you want to create the rule.
  • priority - (Required) The setting that determines the processing order of the rule in the rule group. DNS Firewall processes the rules in a rule group by order of priority, starting from the lowest setting.

Attributes Reference

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

  • id - The ID of the rule.

Import

Route 53 Resolver DNS Firewall rules can be imported using the Route 53 Resolver DNS Firewall rule group ID and domain list ID separated by ':', e.g.,

$ terraform import aws_route53_resolver_firewall_rule.example rslvr-frg-0123456789abcdef:rslvr-fdl-0123456789abcdef