Use sys domains when pointing records to servers #117

Merged
jake merged 3 commits from chore/cname-sys-domains into master 2023-12-31 21:42:40 +00:00
6 changed files with 65 additions and 57 deletions

View file

@ -5,10 +5,10 @@ resource "gandi_livedns_domain" "orngone" {
resource "gandi_livedns_record" "orngone_apex" { resource "gandi_livedns_record" "orngone_apex" {
zone = gandi_livedns_domain.orngone.id zone = gandi_livedns_domain.orngone.id
name = "@" name = "@"
type = "A" type = "ALIAS" # Gandi doesn't support CNAME-flattening
ttl = 3600 ttl = 3600
values = [ values = [
linode_instance.casey.ip_address cloudflare_record.sys_domain_pve.hostname
] ]
} }

View file

@ -77,10 +77,10 @@ resource "linode_firewall" "casey" {
resource "linode_rdns" "casey_reverse_ipv4" { resource "linode_rdns" "casey_reverse_ipv4" {
address = linode_instance.casey.ip_address address = linode_instance.casey.ip_address
rdns = "casey.sys.theorangeone.net" rdns = cloudflare_record.sys_domain_casey.hostname
} }
resource "linode_rdns" "casey_reverse_ipv6" { resource "linode_rdns" "casey_reverse_ipv6" {
address = split("/", linode_instance.casey.ipv6)[0] address = split("/", linode_instance.casey.ipv6)[0]
rdns = "casey.sys.theorangeone.net" rdns = cloudflare_record.sys_domain_casey.hostname
} }

View file

@ -63,96 +63,96 @@ resource "cloudflare_record" "jakehowardtech_dmarc" {
resource "cloudflare_record" "jakehowardtech_wallabag" { resource "cloudflare_record" "jakehowardtech_wallabag" {
zone_id = cloudflare_zone.jakehowardtech.id zone_id = cloudflare_zone.jakehowardtech.id
name = "wallabag" name = "wallabag"
value = linode_instance.casey.ip_address value = cloudflare_record.sys_domain_pve.hostname
type = "A" type = "CNAME"
ttl = 1 ttl = 1
} }
resource "cloudflare_record" "jakehowardtech_ttrss" { resource "cloudflare_record" "jakehowardtech_ttrss" {
zone_id = cloudflare_zone.jakehowardtech.id zone_id = cloudflare_zone.jakehowardtech.id
name = "tt-rss" name = "tt-rss"
value = linode_instance.casey.ip_address value = cloudflare_record.sys_domain_pve.hostname
type = "A" type = "CNAME"
ttl = 1 ttl = 1
} }
resource "cloudflare_record" "jakehowardtech_speed" { resource "cloudflare_record" "jakehowardtech_speed" {
zone_id = cloudflare_zone.jakehowardtech.id zone_id = cloudflare_zone.jakehowardtech.id
name = "speed" name = "speed"
value = linode_instance.casey.ip_address value = cloudflare_record.sys_domain_pve.hostname
type = "A" type = "CNAME"
ttl = 1 ttl = 1
} }
resource "cloudflare_record" "jakehowardtech_quassel" { resource "cloudflare_record" "jakehowardtech_quassel" {
zone_id = cloudflare_zone.jakehowardtech.id zone_id = cloudflare_zone.jakehowardtech.id
name = "quassel" name = "quassel"
value = linode_instance.casey.ip_address value = cloudflare_record.sys_domain_pve.hostname
type = "A" type = "CNAME"
ttl = 1 ttl = 1
} }
resource "cloudflare_record" "jakehowardtech_media" { resource "cloudflare_record" "jakehowardtech_media" {
zone_id = cloudflare_zone.jakehowardtech.id zone_id = cloudflare_zone.jakehowardtech.id
name = "media" name = "media"
value = linode_instance.casey.ip_address value = cloudflare_record.sys_domain_pve.hostname
type = "A" type = "CNAME"
ttl = 1 ttl = 1
} }
resource "cloudflare_record" "jakehowardtech_matrix" { resource "cloudflare_record" "jakehowardtech_matrix" {
zone_id = cloudflare_zone.jakehowardtech.id zone_id = cloudflare_zone.jakehowardtech.id
name = "matrix" name = "matrix"
value = linode_instance.casey.ip_address value = cloudflare_record.sys_domain_pve.hostname
type = "A" type = "CNAME"
ttl = 1 ttl = 1
} }
resource "cloudflare_record" "jakehowardtech_intersect" { resource "cloudflare_record" "jakehowardtech_intersect" {
zone_id = cloudflare_zone.jakehowardtech.id zone_id = cloudflare_zone.jakehowardtech.id
name = "intersect" name = "intersect"
value = linode_instance.casey.ip_address value = cloudflare_record.sys_domain_pve.hostname
type = "A" type = "CNAME"
ttl = 1 ttl = 1
} }
resource "cloudflare_record" "jakehowardtech_calibre" { resource "cloudflare_record" "jakehowardtech_calibre" {
zone_id = cloudflare_zone.jakehowardtech.id zone_id = cloudflare_zone.jakehowardtech.id
name = "calibre" name = "calibre"
value = linode_instance.casey.ip_address value = cloudflare_record.sys_domain_pve.hostname
type = "A" type = "CNAME"
ttl = 1 ttl = 1
} }
resource "cloudflare_record" "jakehowardtech_homeassistant" { resource "cloudflare_record" "jakehowardtech_homeassistant" {
zone_id = cloudflare_zone.jakehowardtech.id zone_id = cloudflare_zone.jakehowardtech.id
name = "homeassistant" name = "homeassistant"
value = linode_instance.casey.ip_address value = cloudflare_record.sys_domain_pve.hostname
type = "A" type = "CNAME"
ttl = 1 ttl = 1
} }
resource "cloudflare_record" "jakehowardtech_grafana" { resource "cloudflare_record" "jakehowardtech_grafana" {
zone_id = cloudflare_zone.jakehowardtech.id zone_id = cloudflare_zone.jakehowardtech.id
name = "grafana" name = "grafana"
value = linode_instance.casey.ip_address value = cloudflare_record.sys_domain_pve.hostname
type = "A" type = "CNAME"
ttl = 1 ttl = 1
} }
resource "cloudflare_record" "jakehowardtech_vaultwarden" { resource "cloudflare_record" "jakehowardtech_vaultwarden" {
zone_id = cloudflare_zone.jakehowardtech.id zone_id = cloudflare_zone.jakehowardtech.id
name = "vaultwarden" name = "vaultwarden"
value = linode_instance.casey.ip_address value = cloudflare_record.sys_domain_pve.hostname
type = "A" type = "CNAME"
ttl = 1 ttl = 1
} }
resource "cloudflare_record" "jakehowardtech_tandoor" { resource "cloudflare_record" "jakehowardtech_tandoor" {
zone_id = cloudflare_zone.jakehowardtech.id zone_id = cloudflare_zone.jakehowardtech.id
name = "recipes" name = "recipes"
value = linode_instance.casey.ip_address value = cloudflare_record.sys_domain_pve.hostname
type = "A" type = "CNAME"
ttl = 1 ttl = 1
} }
@ -183,8 +183,8 @@ resource "cloudflare_record" "jakehowardtech_mailgun_dmarc" {
resource "cloudflare_record" "jakehowardtech_matrix_admin" { resource "cloudflare_record" "jakehowardtech_matrix_admin" {
zone_id = cloudflare_zone.jakehowardtech.id zone_id = cloudflare_zone.jakehowardtech.id
name = "synapse-admin" name = "synapse-admin"
value = linode_instance.casey.ip_address value = cloudflare_record.sys_domain_pve.hostname
type = "A" type = "CNAME"
ttl = 1 ttl = 1
} }
@ -200,48 +200,48 @@ resource "cloudflare_record" "jakehowardtech_apex" {
resource "cloudflare_record" "jakehowardtech_collabora" { resource "cloudflare_record" "jakehowardtech_collabora" {
zone_id = cloudflare_zone.jakehowardtech.id zone_id = cloudflare_zone.jakehowardtech.id
name = "collabora" name = "collabora"
value = linode_instance.casey.ip_address value = cloudflare_record.sys_domain_pve.hostname
type = "A" type = "CNAME"
ttl = 1 ttl = 1
} }
resource "cloudflare_record" "jakehowardtech_tasks" { resource "cloudflare_record" "jakehowardtech_tasks" {
zone_id = cloudflare_zone.jakehowardtech.id zone_id = cloudflare_zone.jakehowardtech.id
name = "tasks" name = "tasks"
value = linode_instance.casey.ip_address value = cloudflare_record.sys_domain_pve.hostname
type = "A" type = "CNAME"
ttl = 1 ttl = 1
} }
resource "cloudflare_record" "jakehowardtech_auth" { resource "cloudflare_record" "jakehowardtech_auth" {
zone_id = cloudflare_zone.jakehowardtech.id zone_id = cloudflare_zone.jakehowardtech.id
name = "auth" name = "auth"
value = linode_instance.casey.ip_address value = cloudflare_record.sys_domain_pve.hostname
type = "A" type = "CNAME"
ttl = 1 ttl = 1
} }
resource "cloudflare_record" "jakehowardtech_minio" { resource "cloudflare_record" "jakehowardtech_minio" {
zone_id = cloudflare_zone.jakehowardtech.id zone_id = cloudflare_zone.jakehowardtech.id
name = "minio" name = "minio"
value = linode_instance.casey.ip_address value = cloudflare_record.sys_domain_pve.hostname
type = "A" type = "CNAME"
ttl = 1 ttl = 1
} }
resource "cloudflare_record" "jakehowardtech_s3" { resource "cloudflare_record" "jakehowardtech_s3" {
zone_id = cloudflare_zone.jakehowardtech.id zone_id = cloudflare_zone.jakehowardtech.id
name = "s3" name = "s3"
value = linode_instance.casey.ip_address value = cloudflare_record.sys_domain_pve.hostname
type = "A" type = "CNAME"
ttl = 1 ttl = 1
} }
resource "cloudflare_record" "jakehowardtech_ntfy" { resource "cloudflare_record" "jakehowardtech_ntfy" {
zone_id = cloudflare_zone.jakehowardtech.id zone_id = cloudflare_zone.jakehowardtech.id
name = "ntfy" name = "ntfy"
value = linode_instance.casey.ip_address value = cloudflare_record.sys_domain_pve.hostname
type = "A" type = "CNAME"
ttl = 1 ttl = 1
} }

View file

@ -29,3 +29,11 @@ resource "cloudflare_record" "sys_domain_walker_v6" {
type = "AAAA" type = "AAAA"
ttl = 1 ttl = 1
} }
resource "cloudflare_record" "sys_domain_pve" {
zone_id = cloudflare_zone.theorangeonenet.id
name = "pve.sys"
value = cloudflare_record.sys_domain_casey.hostname
type = "CNAME"
ttl = 1
}

View file

@ -5,16 +5,16 @@ resource "cloudflare_zone" "theorangeonenet" {
resource "cloudflare_record" "theorangeonenet_git" { resource "cloudflare_record" "theorangeonenet_git" {
zone_id = cloudflare_zone.theorangeonenet.id zone_id = cloudflare_zone.theorangeonenet.id
name = "git" name = "git"
value = linode_instance.casey.ip_address value = cloudflare_record.sys_domain_pve.hostname
type = "A" type = "CNAME"
ttl = 1 ttl = 1
} }
resource "cloudflare_record" "theorangeonenet_whoami" { resource "cloudflare_record" "theorangeonenet_whoami" {
zone_id = cloudflare_zone.theorangeonenet.id zone_id = cloudflare_zone.theorangeonenet.id
name = "whoami" name = "whoami"
value = linode_instance.casey.ip_address value = cloudflare_record.sys_domain_pve.hostname
type = "A" type = "CNAME"
ttl = 1 ttl = 1
} }
@ -109,7 +109,7 @@ resource "cloudflare_record" "theorangeonenet_srv_matrix" {
data = { data = {
service = "_matrix" service = "_matrix"
proto = "_tcp" proto = "_tcp"
name = "theorangeone.net" name = cloudflare_zone.theorangeonenet.zone
priority = 10 priority = 10
weight = 0 weight = 0
port = 8448 port = 8448
@ -120,8 +120,8 @@ resource "cloudflare_record" "theorangeonenet_srv_matrix" {
resource "cloudflare_record" "theorangeonenet_matrix" { resource "cloudflare_record" "theorangeonenet_matrix" {
zone_id = cloudflare_zone.theorangeonenet.id zone_id = cloudflare_zone.theorangeonenet.id
name = "matrix" name = "matrix"
value = linode_instance.casey.ip_address value = cloudflare_record.sys_domain_pve.hostname
type = "A" type = "CNAME"
ttl = 1 ttl = 1
} }
@ -152,16 +152,16 @@ resource "cloudflare_record" "theorangeonenet_notes" {
resource "cloudflare_record" "theorangeonenet_privatebin" { resource "cloudflare_record" "theorangeonenet_privatebin" {
zone_id = cloudflare_zone.theorangeonenet.id zone_id = cloudflare_zone.theorangeonenet.id
name = "bin" name = "bin"
value = linode_instance.casey.ip_address value = cloudflare_record.sys_domain_pve.hostname
type = "A" type = "CNAME"
ttl = 1 ttl = 1
} }
resource "cloudflare_record" "theorangeonenet_dokku" { resource "cloudflare_record" "theorangeonenet_dokku" {
zone_id = cloudflare_zone.theorangeonenet.id zone_id = cloudflare_zone.theorangeonenet.id
name = "d" name = "d"
value = linode_instance.casey.ip_address value = cloudflare_record.sys_domain_pve.hostname
type = "A" type = "CNAME"
ttl = 1 ttl = 1
} }
@ -224,8 +224,8 @@ resource "cloudflare_record" "theorangeonenet_mailgun_dmarc" {
resource "cloudflare_record" "theorangeonenet_mastodon" { resource "cloudflare_record" "theorangeonenet_mastodon" {
zone_id = cloudflare_zone.theorangeonenet.id zone_id = cloudflare_zone.theorangeonenet.id
name = "mastodon" name = "mastodon"
value = linode_instance.casey.ip_address value = cloudflare_record.sys_domain_pve.hostname
type = "A" type = "CNAME"
ttl = 1 ttl = 1
} }

View file

@ -18,11 +18,11 @@ resource "vultr_instance" "walker" {
resource "vultr_reverse_ipv4" "walker_reverse_ipv4" { resource "vultr_reverse_ipv4" "walker_reverse_ipv4" {
instance_id = vultr_instance.walker.id instance_id = vultr_instance.walker.id
ip = vultr_instance.walker.main_ip ip = vultr_instance.walker.main_ip
reverse = "walker.sys.theorangeone.net" reverse = cloudflare_record.sys_domain_walker.hostname
} }
resource "vultr_reverse_ipv6" "walker_reverse_ipv6" { resource "vultr_reverse_ipv6" "walker_reverse_ipv6" {
instance_id = vultr_instance.walker.id instance_id = vultr_instance.walker.id
ip = vultr_instance.walker.v6_main_ip ip = vultr_instance.walker.v6_main_ip
reverse = "walker.sys.theorangeone.net" reverse = cloudflare_record.sys_domain_walker.hostname
} }