Skip to content

AWS Route53 Terraform module with existing Hosted Zone and complete examples

License

Notifications You must be signed in to change notification settings

nbmustafa/terraform-aws-route53-module

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Terraform AWS Route53

Terraform module to create Route53 resource on AWS for zone and record set.

Terraform Licence


DevSecOps and Cloud Engineering standardizing architecture while ensuring the architecture is security complaint.

This module consist of terraform code to create aws Route53 records Terraform open source and examples. It also helps to create and improve your infrastructure with minimalistic code instead of repeating and maintaining the whole infrastructure code.

Prerequisites

This module has a few dependencies:

Route53 Records

This module creates DNS records in Route53 zone.

Requirements

Name Version
terraform >= 0.12.6
aws >= 2.49

Providers

Name Version
aws >= 2.49

Inputs

Name Description Type Default Required
records List of maps of DNS records any [] no
hosted_zone Name of DNS zone string null no

Outputs

Name Description
this_route53_record_fqdn FQDN built using the zone domain and name
this_route53_record_name The name of the record

## Authors

Module maintained by Nashwan Mustafa.

Examples

1. A record with alias

  • this example will create an A record with Alias pointing to a resource name for example alb, s3, cloudfront, etc.
module "service_dns_a_record" {
  source  = "nashvan/route53-module/aws"
  version = "1.2.0"

  hosted_zone = local.account_config["hosted_zone"]
  
  records = [
    {
      name  = "${var.environment_name}.${local.app_name}"
      type  = "A"
      alias = {
        name    = "abc-1830827336.xyz.elb.amazonaws.com"
        zone_id = "Z35SXDOTRQ7X7K"
      }
    }
  ]

}

2. A record with no alias

  • this example will create an A record pointing to the IP address
module "service_dns" {
  source  = "nashvan/route53-module/aws"
  version = "1.2.0"

  hosted_zone = local.account_config["hosted_zone"]
  
  records = [
    {
      name  = "abc"
      type  = "A"
      ttl   = 3600
      records = ["10.10.10.10",]
    }
  ]

}

3. CNAME record

  • this example will create a CNAME record (poiting an fqdn to another fqdn for example)
module "service_dns_cname" {
  source  = "nashvan/route53-module/aws"
  version = "1.2.0"

  hosted_zone = local.account_config["hosted_zone"]
  
  records = [
    {
      name    = "xyz"
      type    = "CNAME"
      ttl     = "5"
      records = ["develop.abc.test.info.",]
    }
  ]
}

// Will create the following record for you // xyz.cmcloudlab912.info CNAME Simple - No develop.abc.cmcloudlab912.info. 5

4. CNAME wighted routing policy

module "service_dns_cname" {
  source  = "nashvan/route53-module/aws"
  version = "1.2.0"

  hosted_zone = local.account_config["hosted_zone"]
  
  records = [
    {
      name    = "test"
      type    = "CNAME"
      ttl     = "5"
      records = ["develop.abc.test.info.",]

      weighted_routing_policy = {
        weight         = 90
      }
      set_identifier = "develop"

    }
  ]
}

// Will create the following record for you // test.test.info CNAME Weighted 90 No develop.abc.test.info.

test.cmcloudlab912.info CNAME Simple - No develop.abc.cmcloudlab912.info. 5

About us

Experience in Security, DevOps, Cloud Archetecture, and infrastructure automation.

Kurdish by blood and values!


We ❤️ DevSecOps and Cloud Engineering

About

AWS Route53 Terraform module with existing Hosted Zone and complete examples

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages