Provision DNS records for liatr.io subdomains in the liatrio/liatrio-external-dns Terraform/Terragrunt repository.
Repository Location
Clone URL: git@github.com:liatrio/liatrio-external-dns.git
If the repo is not already cloned locally, clone it to the user's working directory before proceeding.
Repository Structure
liatrio-external-dns/
├── dns/
│ ├── liatr_io_records.tf # All liatr.io DNS records (primary file to edit)
│ ├── k8s_ignite_com_records.tf # k8s-ignite.com DNS records
│ ├── zones.tf # Route53 hosted zones
│ ├── certificates.tf # ACM wildcard certificates
│ ├── redirects.tf # CloudFront redirect modules
│ ├── domains.tf # Registered domain imports
│ └── terragrunt.hcl # Terragrunt config
├── modules/
│ ├── cloudfront-redirect/ # Module for HTTP redirects via CloudFront
│ └── wildcard-acm-cert/ # Module for wildcard ACM certs with DNS validation
├── insights-liatrio-com/ # S3 + CloudFront for insights.liatrio.com
├── root.hcl # Shared Terragrunt config (S3 backend, provider)
└── shared.tfvars # Shared variables (region: us-east-1)
Record Types and Patterns
CNAME to GitHub Pages (most common)
For sites hosted on GitHub Pages under the liatrio org:
# <description>.liatr.io
resource "aws_route53_record" "<name>_liatr_io" {
zone_id = aws_route53_zone.liatr_io.zone_id
name = "<name>.liatr.io"
type = "CNAME"
ttl = 300
records = ["liatrio.github.io"]
}
- Resource name convention: replace hyphens with underscores, append
_liatr_io - For repos under
liatrio-labsorg, useliatrio-labs.github.ioinstead - For repos under
liatrio-clientsorg, useliatrio-clients.github.ioinstead
CNAME to External Service
For domains pointing to Vercel, Azure, or other external services:
resource "aws_route53_record" "<name>_liatr_io" {
zone_id = aws_route53_zone.liatr_io.zone_id
name = "<name>.liatr.io"
type = "CNAME"
ttl = 300
records = ["<target-domain>"]
}
A Record (GitHub Pages apex or similar)
For apex domains or GitHub Pages A records:
resource "aws_route53_record" "<name>_liatr_io" {
zone_id = aws_route53_zone.liatr_io.zone_id
name = "<name>.liatr.io"
type = "A"
ttl = 300
records = local.github_pages_ips
}
The local.github_pages_ips variable is defined at the top of liatr_io_records.tf.
CloudFront Redirect
To redirect a subdomain to another URL, add a module in dns/redirects.tf and A/AAAA alias records in dns/liatr_io_records.tf:
# In redirects.tf:
module "<name>_liatr_io_redirect" {
source = "../modules/cloudfront-redirect"
name = "<name>-liatr-io-redirect"
destination_url = "<target-url>"
origin_domain = "<name>.liatr.io"
certificate_arn = module.liatr_io_wildcard_cert.certificate_arn
tags = var.tags
}
# In liatr_io_records.tf:
resource "aws_route53_record" "<name>_liatr_io_redirect" {
zone_id = aws_route53_zone.liatr_io.zone_id
name = "<name>.liatr.io"
type = "A"
alias {
name = module.<name>_liatr_io_redirect.domain_name
zone_id = module.<name>_liatr_io_redirect.hosted_zone_id
evaluate_target_health = false
}
}
resource "aws_route53_record" "<name>_liatr_io_redirect_ipv6" {
zone_id = aws_route53_zone.liatr_io.zone_id
name = "<name>.liatr.io"
type = "AAAA"
alias {
name = module.<name>_liatr_io_redirect.domain_name
zone_id = module.<name>_liatr_io_redirect.hosted_zone_id
evaluate_target_health = false
}
}
NS Delegation
To delegate a subdomain to another DNS provider or AWS account:
resource "aws_route53_record" "<name>_liatr_io_ns" {
zone_id = aws_route53_zone.liatr_io.zone_id
name = "<name>.liatr.io"
type = "NS"
ttl = 300
records = ["ns1.example.com", "ns2.example.com", "ns3.example.com", "ns4.example.com"]
}
Workflow
- Create a branch following the naming convention:
add-<name>-liatr-io-cname(or similar descriptive name) - Add the DNS record to
dns/liatr_io_records.tf(or appropriate file) - Commit with message format:
chore: add CNAME for <name>.liatr.io - Push and create a PR — the
pr.yamlworkflow will runterragrunt planand comment the changes on the PR - After merge, the
apply.yamlworkflow runsterragrunt applyautomatically
Important Reminders
- For GitHub Pages sites, the target repo also needs a
CNAMEfile or custom domain configured in Settings > Pages - The hosted zone reference is
aws_route53_zone.liatr_io.zone_idforliatr.iosubdomains - The hosted zone reference is
aws_route53_zone.k8s_ignite_com.zone_idfork8s-ignite.comsubdomains - The
platform.liatr.iosubdomain has its own zone:aws_route53_zone.platform_liatr_io.zone_id - Wildcard ACM certs already exist for
liatr.ioandk8s-ignite.com(incertificates.tf) - Run
tofu fmton changed files before committing — CI checks formatting