self-hosting/terraform/dns.tf

444 lines
11 KiB
Terraform
Raw Normal View History

locals {
2022-09-10 03:55:48 +02:00
dmarc_value = "\"v=DMARC1; p=none; rua=mailto:failed-dmarc@banditlair.com; ruf=mailto:dmarc@banditlair.com\""
2024-12-05 01:57:40 +01:00
hel1_ip = "37.27.138.62"
2024-12-18 06:01:30 +01:00
hel1_ipv6 = "2a01:4f9:3100:1202::2"
}
2024-09-12 15:14:15 +02:00
data "hetznerdns_zone" "froidmont_solutions_zone" {
name = "froidmont.solutions"
}
2025-11-23 23:06:16 +01:00
resource "hetznerdns_record" "nextcloud_froidmont_solutions_a" {
zone_id = data.hetznerdns_zone.froidmont_solutions_zone.id
name = "cloud"
value = local.hel1_ip
type = "A"
ttl = 600
}
data "hetznerdns_zone" "banditlair_zone" {
name = "banditlair.com"
}
resource "hetznerdns_record" "banditlair_hcloud_a" {
zone_id = data.hetznerdns_zone.banditlair_zone.id
2021-09-02 16:11:58 +02:00
name = "@"
2024-12-10 11:39:55 +01:00
value = local.hel1_ip
2021-09-02 16:11:58 +02:00
type = "A"
ttl = 600
}
2025-12-09 01:47:51 +01:00
resource "hetznerdns_record" "banditlair_mcmap_a" {
zone_id = data.hetznerdns_zone.banditlair_zone.id
name = "mcmap"
value = local.hel1_ip
type = "A"
ttl = 600
}
2021-12-27 16:39:22 +01:00
resource "hetznerdns_record" "webmail_a" {
zone_id = data.hetznerdns_zone.banditlair_zone.id
name = "webmail"
2024-12-10 11:39:55 +01:00
value = local.hel1_ip
2021-12-27 16:39:22 +01:00
type = "A"
ttl = 600
}
resource "hetznerdns_record" "mail_a" {
zone_id = data.hetznerdns_zone.banditlair_zone.id
name = "mail"
2024-12-18 06:01:30 +01:00
value = local.hel1_ip
type = "A"
ttl = 600
}
2025-12-15 15:38:45 +01:00
# resource "hetznerdns_record" "mail_aaaa" {
# zone_id = data.hetznerdns_zone.banditlair_zone.id
# name = "mail"
# value = local.hel1_ipv6
# type = "AAAA"
# ttl = 600
# }
2022-09-10 03:55:48 +02:00
2024-12-05 01:57:40 +01:00
resource "hetznerdns_record" "hel1_a" {
zone_id = data.hetznerdns_zone.banditlair_zone.id
name = "hel1"
value = local.hel1_ip
type = "A"
ttl = 600
}
2022-09-15 21:42:58 +02:00
resource "hetznerdns_record" "grafana_a" {
zone_id = data.hetznerdns_zone.banditlair_zone.id
name = "grafana"
2024-12-11 05:02:44 +01:00
value = local.hel1_ip
2022-09-15 21:42:58 +02:00
type = "A"
ttl = 600
}
2021-12-07 01:55:01 +01:00
resource "hetznerdns_record" "jellyfin_a" {
zone_id = data.hetznerdns_zone.banditlair_zone.id
name = "jellyfin"
2024-12-10 11:39:55 +01:00
value = local.hel1_ip
2021-12-09 09:28:28 +01:00
type = "A"
ttl = 600
}
2022-12-02 06:36:45 +01:00
resource "hetznerdns_record" "status_banditlair_a" {
zone_id = data.hetznerdns_zone.banditlair_zone.id
name = "status"
2024-12-10 11:39:55 +01:00
value = local.hel1_ip
2024-09-20 03:55:11 +02:00
type = "A"
ttl = 600
}
2021-12-27 17:17:02 +01:00
resource "hetznerdns_record" "jitsi_a" {
zone_id = data.hetznerdns_zone.froidmont_zone.id
name = "jitsi"
2024-12-10 11:39:55 +01:00
value = local.hel1_ip
2022-12-01 02:31:13 +01:00
type = "A"
2022-12-02 06:36:45 +01:00
ttl = 600
}
resource "hetznerdns_record" "uptime_a" {
zone_id = data.hetznerdns_zone.froidmont_zone.id
name = "uptime"
2024-12-10 11:39:55 +01:00
value = local.hel1_ip
2022-12-02 06:36:45 +01:00
type = "A"
2021-12-27 17:17:02 +01:00
ttl = 600
}
2021-12-10 03:02:34 +01:00
resource "hetznerdns_record" "transmission_a" {
zone_id = data.hetznerdns_zone.banditlair_zone.id
name = "transmission"
2024-12-10 11:39:55 +01:00
value = local.hel1_ip
2021-12-10 03:02:34 +01:00
type = "A"
ttl = 600
}
resource "hetznerdns_record" "jackett_a" {
zone_id = data.hetznerdns_zone.banditlair_zone.id
name = "jackett"
2024-12-10 11:39:55 +01:00
value = local.hel1_ip
2021-12-10 03:02:34 +01:00
type = "A"
ttl = 600
}
resource "hetznerdns_record" "sonarr_a" {
zone_id = data.hetznerdns_zone.banditlair_zone.id
name = "sonarr"
2024-12-10 11:39:55 +01:00
value = local.hel1_ip
2021-12-10 03:02:34 +01:00
type = "A"
ttl = 600
}
resource "hetznerdns_record" "radarr_a" {
zone_id = data.hetznerdns_zone.banditlair_zone.id
name = "radarr"
2024-12-10 11:39:55 +01:00
value = local.hel1_ip
2021-12-10 03:02:34 +01:00
type = "A"
ttl = 600
}
2023-09-08 07:03:59 +02:00
resource "hetznerdns_record" "lidarr_a" {
2021-12-10 03:02:34 +01:00
zone_id = data.hetznerdns_zone.banditlair_zone.id
2023-09-08 07:03:59 +02:00
name = "lidarr"
2024-12-10 11:39:55 +01:00
value = local.hel1_ip
2021-12-10 03:02:34 +01:00
type = "A"
ttl = 600
}
2023-10-12 02:59:56 +02:00
resource "hetznerdns_record" "vtt_a" {
zone_id = data.hetznerdns_zone.banditlair_zone.id
name = "vtt"
2024-12-10 11:39:55 +01:00
value = local.hel1_ip
2023-10-12 02:59:56 +02:00
type = "A"
ttl = 600
}
2024-12-14 05:07:09 +01:00
resource "hetznerdns_record" "photos_a" {
zone_id = data.hetznerdns_zone.banditlair_zone.id
name = "photos"
value = local.hel1_ip
type = "A"
ttl = 600
}
2021-12-09 09:28:28 +01:00
resource "hetznerdns_record" "monero_a" {
zone_id = data.hetznerdns_zone.banditlair_zone.id
name = "monero"
2024-12-10 11:39:55 +01:00
value = local.hel1_ip
2021-12-07 01:55:01 +01:00
type = "A"
ttl = 600
}
2021-12-07 14:57:13 +01:00
2021-12-07 08:34:21 +01:00
resource "hetznerdns_record" "anderia_a" {
zone_id = data.hetznerdns_zone.banditlair_zone.id
name = "anderia"
2024-12-10 11:39:55 +01:00
value = local.hel1_ip
2021-12-07 08:34:21 +01:00
type = "A"
ttl = 600
}
2021-12-07 14:57:13 +01:00
2021-12-07 08:34:21 +01:00
resource "hetznerdns_record" "arkadia_a" {
zone_id = data.hetznerdns_zone.banditlair_zone.id
name = "arkadia"
2024-12-10 11:39:55 +01:00
value = local.hel1_ip
2021-12-07 08:34:21 +01:00
type = "A"
ttl = 600
}
2024-04-23 23:20:44 +02:00
resource "hetznerdns_record" "cifirpg_a" {
zone_id = data.hetznerdns_zone.banditlair_zone.id
name = "scifirpg"
2024-12-10 11:39:55 +01:00
value = local.hel1_ip
2024-04-23 23:20:44 +02:00
type = "A"
ttl = 600
}
resource "hetznerdns_record" "banditlair_dedicated_a" {
zone_id = data.hetznerdns_zone.banditlair_zone.id
2021-09-02 16:11:58 +02:00
name = "*"
2024-12-18 06:01:30 +01:00
value = local.hel1_ip
2021-09-02 16:11:58 +02:00
type = "A"
ttl = 600
}
2021-07-24 03:02:54 +02:00
resource "hetznerdns_record" "nextcloud_a" {
zone_id = data.hetznerdns_zone.banditlair_zone.id
2021-09-02 16:11:58 +02:00
name = "cloud"
2024-12-10 11:39:55 +01:00
value = local.hel1_ip
2021-09-02 16:11:58 +02:00
type = "A"
ttl = 600
2021-07-24 03:02:54 +02:00
}
# Matrix
resource "hetznerdns_record" "matrix_a" {
zone_id = data.hetznerdns_zone.banditlair_zone.id
2021-09-02 16:11:58 +02:00
name = "matrix"
2024-12-10 11:39:55 +01:00
value = local.hel1_ip
2021-09-02 16:11:58 +02:00
type = "A"
ttl = 600
}
resource "hetznerdns_record" "matrix_srv" {
zone_id = data.hetznerdns_zone.banditlair_zone.id
2021-09-02 16:11:58 +02:00
name = "_matrix._tcp"
value = "12 10 443 matrix"
type = "SRV"
ttl = 86400
}
resource "hetznerdns_record" "coturn_a" {
zone_id = data.hetznerdns_zone.banditlair_zone.id
name = "turn"
2024-12-10 11:39:55 +01:00
value = local.hel1_ip
type = "A"
ttl = 600
}
2025-08-28 23:47:37 +02:00
resource "hetznerdns_record" "ch_a" {
zone_id = data.hetznerdns_zone.banditlair_zone.id
name = "ch"
value = local.hel1_ip
type = "A"
ttl = 600
}
2025-08-29 16:08:14 +02:00
resource "hetznerdns_record" "hs_a" {
zone_id = data.hetznerdns_zone.banditlair_zone.id
name = "hs"
value = local.hel1_ip
type = "A"
ttl = 600
}
# Email
resource "hetznerdns_record" "mail_mx" {
zone_id = data.hetznerdns_zone.banditlair_zone.id
2021-09-02 16:11:58 +02:00
name = "@"
value = "12 mail"
type = "MX"
ttl = 86400
}
resource "hetznerdns_record" "spf_txt" {
zone_id = data.hetznerdns_zone.banditlair_zone.id
2021-09-02 16:11:58 +02:00
name = "@"
value = "\"v=spf1 mx -all\""
type = "TXT"
ttl = 600
}
resource "hetznerdns_record" "dmarc_txt" {
zone_id = data.hetznerdns_zone.banditlair_zone.id
2021-09-02 16:11:58 +02:00
name = "_dmarc"
value = local.dmarc_value
type = "TXT"
ttl = 600
}
resource "hetznerdns_record" "dmarc_report_froidmont_txt" {
zone_id = data.hetznerdns_zone.banditlair_zone.id
2021-09-02 16:11:58 +02:00
name = "froidmont.org._report._dmarc"
value = "\"v=DMARC1\""
type = "TXT"
ttl = 600
}
resource "hetznerdns_record" "dmarc_report_falbo_txt" {
zone_id = data.hetznerdns_zone.banditlair_zone.id
2021-09-02 16:11:58 +02:00
name = "falbo.fr._report._dmarc"
value = "\"v=DMARC1\""
type = "TXT"
ttl = 600
}
resource "hetznerdns_record" "dkim_txt" {
zone_id = data.hetznerdns_zone.banditlair_zone.id
2021-12-26 19:42:23 +01:00
name = "mail._domainkey"
value = "\"v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCgRhQ9zN4hkiASKH4kTfWUSBz+Ov7BvH0459BDVeSNQFjH3KjmofJicKQ6eWXGJOSz4jCpNDRdgMbkVHEiTHOcKd/u9LqxEchWKZU50lwSrYhUmr8j+b4vgf+sUxIWKCZUNuyrDp2ROeheA3Pbx+fYJb3VhGTZecLlchMrRjBJqwIDAQAB\""
2021-09-02 16:11:58 +02:00
type = "TXT"
ttl = 600
}
data "hetznerdns_zone" "falbo_zone" {
name = "falbo.fr"
}
resource "hetznerdns_record" "falbo_a" {
zone_id = data.hetznerdns_zone.falbo_zone.id
2021-09-02 16:11:58 +02:00
name = "@"
value = hetznerdns_record.banditlair_dedicated_a.value
type = "A"
ttl = 600
}
resource "hetznerdns_record" "falbo_cname" {
zone_id = data.hetznerdns_zone.falbo_zone.id
2021-09-02 16:11:58 +02:00
name = "*"
value = "${data.hetznerdns_zone.falbo_zone.name}."
type = "CNAME"
ttl = 600
}
resource "hetznerdns_record" "falbo_mail_mx" {
zone_id = data.hetznerdns_zone.falbo_zone.id
2021-09-02 16:11:58 +02:00
name = "@"
value = "12 mail.${data.hetznerdns_zone.banditlair_zone.name}."
type = "MX"
ttl = 86400
}
resource "hetznerdns_record" "falbo_spf_txt" {
zone_id = data.hetznerdns_zone.falbo_zone.id
2021-09-02 16:11:58 +02:00
name = "@"
value = "\"v=spf1 include:${data.hetznerdns_zone.banditlair_zone.name} -all\""
type = "TXT"
ttl = 600
}
resource "hetznerdns_record" "falbo_dmarc_txt" {
zone_id = data.hetznerdns_zone.falbo_zone.id
2021-09-02 16:11:58 +02:00
name = "_dmarc"
value = local.dmarc_value
type = "TXT"
ttl = 600
}
resource "hetznerdns_record" "falbo_dkim_txt" {
zone_id = data.hetznerdns_zone.falbo_zone.id
2021-12-26 19:42:23 +01:00
name = "mail._domainkey"
value = "\"v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCY6ESTQcWbZVNxjb8TFhpyhCoG6Ri8OV1MijDHGNmpLye8AsuMzaEdcFk59AoIWPI6P9ZGIXzYTTwRxXhCIBrRJgcDGrbTAQ7tuaKggJRCXhan7FVMizZSJ53NEr3f4PFaBtrV0Ni8f7ENuT6WcQQ+JsMN3vEGbwA1LmgHH2XSBQIDAQAB\""
2021-09-02 16:11:58 +02:00
type = "TXT"
ttl = 600
}
data "hetznerdns_zone" "froidmont_zone" {
name = "froidmont.org"
}
resource "hetznerdns_record" "froidmont_a" {
zone_id = data.hetznerdns_zone.froidmont_zone.id
2021-09-02 16:11:58 +02:00
name = "@"
value = hetznerdns_record.banditlair_dedicated_a.value
type = "A"
ttl = 600
}
2021-12-07 14:57:13 +01:00
resource "hetznerdns_record" "website_marie_a" {
zone_id = data.hetznerdns_zone.froidmont_zone.id
name = "osteopathie"
2024-12-10 11:39:55 +01:00
value = local.hel1_ip
2021-12-07 14:57:13 +01:00
type = "A"
ttl = 600
}
2025-03-04 05:20:49 +01:00
resource "hetznerdns_record" "forge_a" {
zone_id = data.hetznerdns_zone.froidmont_zone.id
name = "forge"
value = local.hel1_ip
type = "A"
ttl = 600
}
resource "hetznerdns_record" "froidmont_cname" {
zone_id = data.hetznerdns_zone.froidmont_zone.id
2021-09-02 16:11:58 +02:00
name = "*"
value = "${data.hetznerdns_zone.froidmont_zone.name}."
type = "CNAME"
ttl = 600
}
resource "hetznerdns_record" "froidmont_mail_mx" {
zone_id = data.hetznerdns_zone.froidmont_zone.id
2021-09-02 16:11:58 +02:00
name = "@"
value = "12 mail.${data.hetznerdns_zone.banditlair_zone.name}."
type = "MX"
ttl = 86400
}
resource "hetznerdns_record" "froidmont_spf_txt" {
zone_id = data.hetznerdns_zone.froidmont_zone.id
2021-09-02 16:11:58 +02:00
name = "@"
value = "\"v=spf1 include:${data.hetznerdns_zone.banditlair_zone.name} -all\""
type = "TXT"
ttl = 600
}
resource "hetznerdns_record" "froidmont_dmarc_txt" {
zone_id = data.hetznerdns_zone.froidmont_zone.id
2021-09-02 16:11:58 +02:00
name = "_dmarc"
value = local.dmarc_value
type = "TXT"
ttl = 600
}
resource "hetznerdns_record" "froidmont_dkim_txt" {
zone_id = data.hetznerdns_zone.froidmont_zone.id
2021-12-26 19:42:23 +01:00
name = "mail._domainkey"
value = "\"v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDoY56+gnsfCFGVchumtl7mnRuFENBKoTojxpMZQ8kHPY68pkTg7Xw0M6GtfLQQa/2VGCddQIYcXH74nu7J/4vakEPLp7JYsToqbLOucfXoFbBAQN3N43YyUsp8DqMh80y0UjItHf04HQUfa+OyjJWZD9JZm2oKIAO4Z0X0RoSyWwIDAQAB\""
2021-09-02 16:11:58 +02:00
type = "TXT"
ttl = 600
}
data "hetznerdns_zone" "stb_zone" {
name = "societe-de-tir-bertrix.com"
}
resource "hetznerdns_record" "stb_a" {
zone_id = data.hetznerdns_zone.stb_zone.id
2021-09-02 16:11:58 +02:00
name = "@"
2024-12-10 11:39:55 +01:00
value = local.hel1_ip
2021-09-02 16:11:58 +02:00
type = "A"
ttl = 600
}
resource "hetznerdns_record" "stb_cname" {
zone_id = data.hetznerdns_zone.stb_zone.id
2021-09-02 16:11:58 +02:00
name = "*"
value = "${data.hetznerdns_zone.stb_zone.name}."
type = "CNAME"
ttl = 600
}