README.md

r53-resolver

Creates Route 53 Resolver endpoints and rules for hybrid DNS resolution between a VPC and external DNS servers.

Provisions inbound and outbound resolver endpoints from a single module, along with forwarding rules and their VPC associations. Inbound endpoints let external resolvers query into the VPC. Outbound endpoints let the VPC forward specific domain queries to on-premises or other external DNS servers. Rules define which domains get forwarded and where, and can be associated with one or more VPCs.

Usage

module "r53_resolver" {
  source  = "hcassc.jfrog.io/iac-tf-modules-virtual__networking/r53-resolver/aws"
  version = "0.2.0"

  name_prefix = "acme-prod-internal"

  endpoints = {
    outbound = {
      direction             = "OUTBOUND"
      endpoint_name_suffix  = "dc-outbound"
      endpoint_type         = "IPV4"
      security_group_ids    = [module.security_group.id]
      interfaces = [
        { subnet_id = module.vpc.private_subnet_ids["a"] },
        { subnet_id = module.vpc.private_subnet_ids["b"] },
      ]
    }

    inbound = {
      direction             = "INBOUND"
      endpoint_name_suffix  = "dc-inbound"
      endpoint_type         = "IPV4"
      security_group_ids    = [module.security_group.id]
      interfaces = [
        { subnet_id = module.vpc.private_subnet_ids["a"] },
        { subnet_id = module.vpc.private_subnet_ids["b"] },
      ]
    }
  }

  rules = {
    to_onprem = {
      domain_name       = "corp.internal"
      endpoint_key      = "outbound"
      rule_name_suffix  = "to-onprem"
      target_ips = [
        { ip = "10.50.0.10" },
        { ip = "10.50.0.11" },
      ]
      vpc_ids = [module.vpc.id]
    }
  }
}

Requirements

Name Version
terraform >= 1.15.0, < 2.0.0
aws >= 6.0, < 7.0

Providers

Name Version
aws >= 6.0, < 7.0

Resources

Name Type
aws_route53_resolver_endpoint.this resource
aws_route53_resolver_rule.this resource
aws_route53_resolver_rule_association.this resource

Inputs

Name Description Type Default Required
name_prefix Prefix prepended to resource names created by this module string n/a yes
endpoints Map of resolver endpoint logical key to configuration map(object({ direction = string endpoint_name_suffix = string endpoint_type = optional(string, "IPV4") security_group_ids = list(string) interfaces = list(object({ subnet_id = string ip = optional(string) })) tags = optional(map(string), {}) })) {} no
rules Map of resolver rule logical key to configuration.endpoint_key must reference an OUTBOUND entry in var.endpoints. map(object({ domain_name = string rule_type = optional(string, "FORWARD") endpoint_key = string rule_name_suffix = string target_ips = list(object({ ip = string port = optional(number, 53) })) vpc_ids = list(string) tags = optional(map(string), {}) })) {} no
tags Resource tags to apply to all resources map(string) {} no

Outputs

Name Description
endpoint_arns Map of resolver endpoint logical key to endpoint ARN
endpoint_ids Map of resolver endpoint logical key to endpoint ID
endpoint_ip_addresses Map of resolver endpoint logical key to its list of assigned IP addresses
rule_arns Map of resolver rule logical key to rule ARN
rule_ids Map of resolver rule logical key to rule ID