Skip to content

dasmeta/terraform-aws-dns

Repository files navigation

terraform-aws-dns

Allows to create aws route53 zone and record with simple manner, supports alb/loadbalancer and cdn/cloudfront cases

for enabling git pre-commit/commit-msg hooks run this(other repos will also have it set as it set globally)

git config --global core.hooksPath ./githooks

simple example with alb

module "dns" {
  source  = "dasmeta/dns/aws"
  version = "1.0.1"

  zone        = "test.dasmeta.com"
  records     = [
    {
      target_type = "alb"
      name        = "app1"
      alb         = "k8s-my-test-alb"
    }
  ]
}

Requirements

Name Version
terraform ~> 1.3
aws >= 3.31

Providers

No providers.

Modules

Name Source Version
alb_records ./modules/record-alias-alb n/a
cdn_records ./modules/record-alias-cdn n/a
zone_and_records ./modules/route53 n/a

Resources

No resources.

Inputs

Name Description Type Default Required
create_zone Create zone or use existing zone as data bool false no
private_zone If Route53 zone is private set var is true bool false no
records DNS Record map
list(object({
name = string
target_type = optional(string, "") # for cdn/alb record easy creation can be "alb", "cdn"

type = optional(string, "A") # type for standard records creation, can be "A", "CNAME", "TEXT", and etc
value = optional(list(any), []) # value for standard records creation

alb = optional(string, null) # the name of loadbalancer

distribution_id = optional(string, null) # cloudfront distribution id

set_identifier : optional(string, null) # for setting custom identifier in case we have multiple records(geo routing) for same domain
geolocation_routing_policy : optional(any, {}) # use to define custom routing for each geo location
}))
[] no
zone DNS Zone name record will be injected into string n/a yes

Outputs

Name Description
ns_delegation_set The NS records list for zone to use as delegation set
zone_id zone id