Skip to content

locus313/terraform-module-aws-route53

Repository files navigation

Route53 Terraform module

Terraform module which creates Route53 resources.

Requirements

Name Version
terraform >= 0.13.1
aws >= 2.49

Providers

Name Version
aws >= 2.49
aws.acm >= 2.49

Modules

No modules.

Resources

Name Type
aws_acm_certificate.records_wr resource
aws_acm_certificate_validation.records_wr resource
aws_cloudfront_distribution.records_wr resource
aws_route53_record.records_a resource
aws_route53_record.records_aaaa resource
aws_route53_record.records_caa resource
aws_route53_record.records_cname resource
aws_route53_record.records_mx resource
aws_route53_record.records_ns resource
aws_route53_record.records_txt resource
aws_route53_record.records_wr resource
aws_route53_record.records_wr_validation resource
aws_route53_zone.this resource
aws_s3_bucket.records_wr resource
aws_s3_bucket_website_configuration.records_wr resource

Inputs

Name Description Type Default Required
enabled Whether to enable Route 53 resources bool true no
primary_domain The domain name to manage string n/a yes
records_a Map of A records separate by comma (,) map(list(string)) {} no
records_aaaa Map of AAAA records separate by comma (,) map(list(string)) {} no
records_caa Map of CAA records separate by comma (,) map(list(string)) {} no
records_cname Map of CNAME records separate by comma (,) map(list(string)) {} no
records_mx Map of MX records separate by comma (,) map(list(string)) {} no
records_ns Map of NS records separate by comma (,) map(list(string)) {} no
records_txt Map of TXT records separate by comma (,) map(list(string)) {} no
records_wr Map of redirect records map(string) {} no
ttl Default TTL for All records number "3600" no
ttl_acm Default TTL for acm records number "60" no
ttl_ns Default TTL for ns records number "172800" no

Outputs

Name Description
this_route53_zone_name_servers Name servers of Route53 zone
this_route53_zone_zone_id Zone ID of Route53 zone

Usage

Create Route53 zones and records

module "example-com" {
   source = "locus313/aws-route53/module"
   version = "1.0.5"
   
   enabled                                                     = true
   primary_domain                                              = "example.com"
   
   records_wr = {
     "support.example.com"                                     = "https://example.atlassian.net/servicedesk/customer/portals"
   }
   
   records_a = {
     "example.com"                                             = ["12.23.45.56"]
   }

   records_aaaa = {
     "example.com"                                             = ["::ffff:c17:2d38"]
   }

   records_caa = {
     "example.com"                                             = ["0 issue \"letsencrypt.org\""]
   }
   
   records_cname = {
     "calendar.example.com"                                    = ["ghs.googlehosted.com"]
     "docs.example.com"                                        = ["ghs.googlehosted.com"]
     "ftp.example.com"                                         = ["example.com"]
     "mail.example.com"                                        = ["ghs.googlehosted.com"]
     "sites.example.com"                                       = ["ghs.googlehosted.com"]
     "www.example.com"                                         = ["example.com"]
   }
   
   records_mx = {
     "example.com"                                             = ["10 aspmx.l.google.com","20 alt1.aspmx.l.google.com","30 alt2.aspmx.l.google.com","40 aspmx2.googlemail.com","50 aspmx3.googlemail.com"]
   }
   
   records_txt = {
     "example.com"                                             = ["v=spf1 include:_spf.google.com ~all"]
     "google._domainkey.example.com"                           = ["v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA3gtOkCHXv+kDJBpIkr1lq1Ywd4B8FJGPceSv9s7yhUtCk8pKwifLmSKWNEyOvuK5oxIms+4Vc9Pu46bi/wehi5zJynzhkOrzYXdOX6+m4Nb8NbFWr0zZqsM+pDGmYzRjeczY/+txXnOegcbxL+967bIRisnlH2CRD91h1t0NJwsvvN23T5MAMaeJr726piDdE\"\"C6P2nF1apYbGXp0DZGz/RvtpCGjASjlpejA8I/xLclZOBn4Ir9pk8gajRSG48D21UKJ3d+PFzYEj9X5n1p1i2trjCqkdyCzU+f3vTUxma5F7fQncKYIeRJwVNbmR03IYfGuicCu13hnVP36aT5yuQIDAQAB"]
   }
   
   records_ns = {
     "clusters.example.com"                                    = ["ns-128.awsdns-16.com","ns-1533.awsdns-63.org","ns-1554.awsdns-02.co.uk","ns-956.awsdns-55.net"]
     "envs.example.com"                                        = ["ns-1103.awsdns-09.org","ns-1587.awsdns-06.co.uk","ns-378.awsdns-47.com","ns-693.awsdns-22.net"]
   }
}

Note that depends_on in modules is available since Terraform 0.13.

DNS record types

Supported record types as follows:

Record type Supported
A YES
AAAA YES
CAA YES
CNAME YES
LOC NO
MX YES
NS YES
PTR NO
SOA NO
SRV NO
SPF NO
TXT YES

Authors

Module managed by Patrick Lewis.