orchestration.clouds/ahoskingit/terraform/dns_automatedbytes.tf

106 lines
2.8 KiB
HCL

##Terraform and its management of DNS in route53
#### automatedbytes.com
##Setup the domain in route53
resource "cloudflare_zone" "automatedbytes_com" {
zone = "automatedbytes.com"
}
resource "aws_route53_zone" "automatedbytes" {
name = "automatedbytes.com"
}
#Route53 DNS entry
resource "aws_route53_record" "automatedbytes" {
zone_id = aws_route53_zone.automatedbytes.zone_id
name = "automatedbytes.com"
type = "A"
ttl = "5"
records = [var.home_ip]
}
resource "aws_route53_record" "www_automatedbytes" {
zone_id = aws_route53_zone.automatedbytes.zone_id
name = "www.automatedbytes.com"
type = "CNAME"
ttl = "5"
records = [aws_route53_record.automatedbytes.name]
}
resource "aws_route53_record" "wildcard_automatedbytes" {
zone_id = aws_route53_zone.automatedbytes.zone_id
name = "*.automatedbytes.com"
type = "CNAME"
ttl = "5"
records = [aws_route53_record.automatedbytes.name]
}
resource "aws_route53_record" "support_automatedbytes" {
zone_id = aws_route53_zone.automatedbytes.zone_id
name = "support.automatedbytes.com"
type = "A"
ttl = "5"
records = [var.home_ip]
}
resource "aws_route53_record" "kfa_support_automatedbytes" {
zone_id = aws_route53_zone.automatedbytes.zone_id
name = "kfa.support.automatedbytes.com"
type = "CNAME"
ttl = "5"
records = ["support.automatedbytes.com"]
}
## Email MX records
resource "aws_route53_record" "mx_automatedbytes" {
zone_id = aws_route53_zone.automatedbytes.zone_id
name = aws_route53_zone.automatedbytes.name
type = "MX"
ttl = "60"
records = ["1 ASPMX.L.GOOGLE.COM",
"5 ALT1.ASPMX.L.GOOGLE.COM",
"5 ALT2.ASPMX.L.GOOGLE.COM",
"10 ALT3.ASPMX.L.GOOGLE.COM",
"10 ALT4.ASPMX.L.GOOGLE.COM"]
}
resource "cloudflare_record" "assets_automatedbytes" {
zone_id = cloudflare_zone.automatedbytes_com.id
name = "assets"
type = "A"
proxied = false
value = var.do_assets
}
resource "cloudflare_record" "assets_api_automatedbytes" {
zone_id = cloudflare_zone.automatedbytes_com.id
name = "assets-api"
type = "A"
proxied = false
value = var.do_assets
}
resource "cloudflare_record" "assets_mesh_automatedbytes" {
zone_id = cloudflare_zone.automatedbytes_com.id
name = "assets-mesh"
type = "A"
proxied = false
value = var.do_assets
}
resource "cloudflare_record" "support_automatedbytes" {
zone_id = cloudflare_zone.automatedbytes_com.id
name = "support"
type = "A"
proxied = true
value = var.home_ip
}
resource "cloudflare_record" "itmanagement_automatedbytes" {
zone_id = cloudflare_zone.automatedbytes_com.id
name = "itmanagement"
type = "CNAME"
ttl = "1"
proxied = true
value = join(".", [cloudflare_record.support_automatedbytes.name, cloudflare_zone.automatedbytes_com.zone])
}