Skip to content

Latest commit

 

History

History
 
 

dns-primary

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Component: dns-primary

This component is responsible for provisioning the primary DNS zones into an AWS account. By convention, we typically provision the primary DNS zones in the dns account. The primary account for branded zones (e.g. example.com), however, would be in the prod account, while staging zone (e.g. example.qa) might be in the staging account.

The zones from the primary DNS zone are then expected to be delegated to other accounts via the dns-delegated component. Additional, external records can be created on the primary DNS zones via the record_config variable.

Usage

Stack Level: Global

Here's an example snippet for how to use this component. This component should only be applied once as the DNS zones it creates are global. This is typically done via the DNS stack (e.g. gbl-dns.yaml).

components:
  terraform:
    dns-primary:
      vars:
        domain_names:
          - example.net
        record_config:
          - root_zone: example.net
            name: ""
            type: A
            ttl: 60
            records:
              - 53.229.170.215
          - root_zone: example.net
            name: www
            type: CNAME
            ttl: 60
            records:
              - example.net

Requirements

Name Version
terraform >= 0.14.0
aws ~> 3.32
external ~> 2.1
http ~> 2.0
local ~> 2.0
utils ~> 0.3

Providers

Name Version
aws ~> 3.32

Modules

Name Source Version
iam_roles ../account-map/modules/iam-roles n/a
this cloudposse/label/null 0.24.1

Resources

Name Type
aws_route53_record.aliasrec resource
aws_route53_record.dnsrec resource
aws_route53_record.soa resource
aws_route53_zone.root resource

Inputs

Name Description Type Default Required
additional_tag_map Additional tags for appending to tags_as_list_of_maps. Not added to tags. map(string) {} no
alias_record_config DNS Alias Record config
list(object({
root_zone = string
name = string
type = string
zone_id = string
record = string
target_health = string
}))
[] no
attributes Additional attributes (e.g. 1) list(string) [] no
context Single object for setting entire context at once.
See description of individual variables for details.
Leave string and numeric variables as null to use default value.
Individual variable settings (non-null) override settings in context object,
except for attributes, tags, and additional_tag_map, which are merged.
object({
enabled = bool
namespace = string
environment = string
stage = string
name = string
delimiter = string
attributes = list(string)
tags = map(string)
additional_tag_map = map(string)
regex_replace_chars = string
label_order = list(string)
id_length_limit = number
})
{
"additional_tag_map": {},
"attributes": [],
"delimiter": null,
"enabled": true,
"environment": null,
"id_length_limit": null,
"label_order": [],
"name": null,
"namespace": null,
"regex_replace_chars": null,
"stage": null,
"tags": {}
}
no
delimiter Delimiter to be used between namespace, environment, stage, name and attributes.
Defaults to - (hyphen). Set to "" to use no delimiter at all.
string null no
dns_soa_config Root domain name DNS SOA record string "awsdns-hostmaster.amazon.com. 1 7200 900 1209600 86400" no
domain_names Root domain name list, e.g. ["example.net"] list(string) null no
enabled Set to false to prevent the module from creating any resources bool null no
environment Environment, e.g. 'uw2', 'us-west-2', OR 'prod', 'staging', 'dev', 'UAT' string null no
id_length_limit Limit id to this many characters.
Set to 0 for unlimited length.
Set to null for default, which is 0.
Does not affect id_full.
number null no
import_profile_name AWS Profile name to use when importing a resource string null no
label_order The naming order of the id output and Name tag.
Defaults to ["namespace", "environment", "stage", "name", "attributes"].
You can omit any of the 5 elements, but at least one must be present.
list(string) null no
name Solution name, e.g. 'app' or 'jenkins' string null no
namespace Namespace, which could be your organization name or abbreviation, e.g. 'eg' or 'cp' string null no
record_config DNS Record config
list(object({
root_zone = string
name = string
type = string
ttl = string
records = list(string)
}))
[] no
regex_replace_chars Regex to replace chars with empty string in namespace, environment, stage and name.
If not set, "/[^a-zA-Z0-9-]/" is used to remove all characters other than hyphens, letters and digits.
string null no
region AWS Region string n/a yes
stage Stage, e.g. 'prod', 'staging', 'dev', OR 'source', 'build', 'test', 'deploy', 'release' string null no
tags Additional tags (e.g. map('BusinessUnit','XYZ') map(string) {} no

Outputs

Name Description
zones DNS zones

References