Skip to content

cn-terraform/terraform-aws-route53

Repository files navigation

Route53 Terraform Module for AWS

This Terraform module creates the base networking infrastructure on AWS.

Usage

Check valid versions on:

Install pre commit hooks.

Pleas run this command right after cloning the repository.

    pre-commit install

For that you may need to install the folowwing tools:

In order to run all checks at any point run the following command:

    pre-commit run --all-files

Requirements

Name Version
terraform >= 0.13
aws >= 5

Providers

Name Version
aws 5.17.0

Modules

No modules.

Resources

Name Type
aws_route53_record.records resource
aws_route53_zone.this resource

Inputs

Name Description Type Default Required
comment (Optional) A comment for the hosted zone. Defaults to 'Managed by Terraform' string null no
create_hosted_zone (Optional) If true a hosted zone will be created bool true no
delegation_set_id (Optional) The ID of the reusable delegation set whose NS records you want to assign to the hosted zone. Conflicts with vpc as delegation sets can only be used for public zones. string null no
force_destroy (Optional) Whether to destroy all records (possibly managed outside of Terraform) in the zone when destroying the zone. bool true no
hosted_zone_id (Optional) Required when create_hosted_zone is false. This is the hosted zone where records will be created. string null no
hosted_zone_name (Optional) Required when create_hosted_zone is true. This is the name of the hosted zone. string null no
hosted_zone_tags (Optional) A map of tags to assign to the zone. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level. map(string) {} no
records (Optional) Map of records to add to the hosted zone
map(object({
# (Optional) An alias block. Conflicts with ttl and records.
alias = optional(object({
# (Required) DNS domain name for a CloudFront distribution, S3 bucket, ELB, or another resource record set in this hosted zone.
name = string
# (Required) Hosted zone ID for a CloudFront distribution, S3 bucket, ELB, or Route 53 hosted zone. See resource_elb.zone_id for example.
zone_id = string
# (Required) Set to true if you want Route 53 to determine whether to respond to DNS queries using this resource record set by checking the health of the resource record set. Some resources have special requirements, see related part of documentation.
evaluate_target_health = bool
}))

# (Optional) Allow creation of this record in Terraform to overwrite an existing record, if any. This does not affect the ability to update the record in Terraform and does not prevent other resources within Terraform or manual Route 53 changes outside Terraform from overwriting this record. false by default. This configuration is not recommended for most environments.
allow_overwrite = optional(bool)

# (Optional) The health check the record should be associated with.
health_check_id = optional(string)

# (Required for non-alias records) A string list of records. To specify a single record value longer than 255 characters such as a TXT record for DKIM, add "" inside the Terraform configuration string (e.g., "first255characters""morecharacters").
records = optional(list(string))

# (Required for non-alias records) The TTL of the record.
ttl = optional(number)

# (Required) The record type. Valid values are A, AAAA, CAA, CNAME, DS, MX, NAPTR, NS, PTR, SOA, SPF, SRV and TXT.
type = string
}))
{} no
vpc (Optional) Configuration block(s) specifying VPC(s) to associate with a private hosted zone. Conflicts with the delegation_set_id argument in this resource and any aws_route53_zone_association resource specifying the same zone ID.
object({
# (Required) ID of the VPC to associate.
vpc_id = string
# (Optional) Region of the VPC to associate. Defaults to AWS provider region.
vpc_region = optional(string)
})
null no

Outputs

Name Description
arn The Amazon Resource Name (ARN) of the Hosted Zone.
name_servers A list of name servers in associated (or default) delegation set. Find more about delegation sets in AWS docs.
primary_name_server The Route 53 name server that created the SOA record.
records ------------------------------------------------------------------------------ Records ------------------------------------------------------------------------------
tags_all A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.
zone_id The Hosted Zone ID. This can be referenced by zone records.