Module: route53-alias
Terraform module that implements "vanity" host names (e.g. brand.com
) as ALIAS
records to another Route53 DNS resource record (e.g. ELB/ALB, S3 Bucket Endpoint or CloudFront Distribution).
Unlike CNAME
records, the synthetic ALIAS
record works with zone apexes.
Usage
This will define a A
resource record for www.example.com
as an alias of the aws_elb.example.dns_name
.
module "production_www" {
source = "cloudposse/route53-alias/aws"
# Cloud Posse recommends pinning every module to a specific version
# version = "x.x.x"
aliases = ["www.example.com.", "static1.cdn.example.com.", "static2.cdn.example.com"]
parent_zone_id = var.parent_zone_id
target_dns_name = aws_elb.example.dns_name
target_zone_id = aws_elb.example.zone_id
}
Variables
Required Variables
aliases
(list(string)
) requiredList of aliases
target_dns_name
(string
) requiredDNS name of target resource (e.g. ALB, ELB)
target_zone_id
(string
) requiredID of target resource (e.g. ALB, ELB)
Optional Variables
allow_overwrite
(bool
) optionalAllow 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
Default value:
false
evaluate_target_health
(bool
) optionalSet to true if you want Route 53 to determine whether to respond to DNS queries
Default value:
false
ipv6_enabled
(bool
) optionalSet to true to enable an AAAA DNS record to be set as well as the A record
Default value:
false
parent_zone_id
(string
) optionalID of the hosted zone to contain this record (or specify
parent_zone_name
)Default value:
""
parent_zone_name
(string
) optionalName of the hosted zone to contain this record (or specify
parent_zone_id
)Default value:
""
private_zone
(bool
) optionalIs this a private hosted zone?
Default value:
false
Context Variables
The following variables are defined in the context.tf
file of this module and part of the terraform-null-label pattern.
context.tf
file of this module and part of the terraform-null-label pattern.Outputs
hostnames
List of DNS records
parent_zone_id
ID of the hosted zone to contain the records
parent_zone_name
Name of the hosted zone to contain the records
Dependencies
Requirements
terraform
, version:>= 0.13.0
aws
, version:>= 2.0
local
, version:>= 1.2
Providers
aws
, version:>= 2.0
Modules
Name | Version | Source | Description |
---|---|---|---|
this | 0.25.0 | cloudposse/label/null | n/a |
Resources
The following resources are used by this module:
aws_route53_record.default
(resource)aws_route53_record.ipv6
(resource)
Data Sources
The following data sources are used by this module:
aws_route53_zone.default
(data source)