aboutsummaryrefslogblamecommitdiff
blob: dd03076a9c1a9d7b1682a9ccde2564673dc03a60 (plain) (tree)




















                                                                 










                                                                 








                                                                             








                                                                             








                                                                             









































                                                                           
# Cloudflare DNS records

# www
variable "homelab_www_domain" {
  default = "clarkzjw.cc"
}

variable "homelab_www_ip" {
  default = "8.8.8.8"
}

resource "cloudflare_record" "main" {
  zone_id = data.cloudflare_zones.homelab_main_domain.zones[0].id
  name    = var.homelab_www_domain
  value   = var.homelab_www_ip
  type    = "A"

  ttl     = 1
  proxied = true
}

# atlas
resource "cloudflare_record" "atlas" {
  zone_id = data.cloudflare_zones.homelab_main_domain.zones[0].id
  name    = "atlas.${var.homelab_www_domain}"
  value   = var.atlas_ip
  type    = "A"

  ttl     = 60
  proxied = false
}

# bt
resource "cloudflare_record" "bt" {
  zone_id = data.cloudflare_zones.homelab_main_domain.zones[0].id
  name    = "bt.${var.homelab_main_domain}"
  value   = "${cloudflare_argo_tunnel.atlas_main_tunnel.id}.cfargotunnel.com"
  type    = "CNAME"
  proxied = true
}

# EdgeRouterX
resource "cloudflare_record" "edgerouterx" {
  name    = "edgerouterx.${var.homelab_main_domain}"
  type    = "CNAME"
  zone_id = data.cloudflare_zones.homelab_main_domain.zones[0].id
  value   = "${cloudflare_argo_tunnel.atlas_main_tunnel.id}.cfargotunnel.com"
  proxied = true
}

# Proxmox
resource "cloudflare_record" "proxmox" {
  name    = "proxmox.${var.homelab_main_domain}"
  type    = "CNAME"
  zone_id = data.cloudflare_zones.homelab_main_domain.zones[0].id
  value   = "${cloudflare_argo_tunnel.atlas_main_tunnel.id}.cfargotunnel.com"
  proxied = true
}

# notify
# DNS config for Mailgun
resource "cloudflare_record" "notify_SPF" {
  zone_id = data.cloudflare_zones.homelab_main_domain.zones[0].id
  # type = "SPF" causes DNS Validation Error (1004)
  # https://github.com/cloudflare/terraform-provider-cloudflare/issues/1473
  type  = "TXT"
  name  = "notify.${var.homelab_main_domain}"
  value = "v=spf1 include:mailgun.org ~all"

  ttl = 1
}

resource "cloudflare_record" "notify_DKIM" {
  name    = "pic._domainkey.notify.${var.homelab_main_domain}"
  type    = "TXT"
  zone_id = data.cloudflare_zones.homelab_main_domain.zones[0].id
  value   = var.homelab_notify_DKIM
}

resource "cloudflare_record" "notify_CNAME" {
  name    = "email.notify.${var.homelab_main_domain}"
  type    = "CNAME"
  zone_id = data.cloudflare_zones.homelab_main_domain.zones[0].id
  value   = "mailgun.org"
}

resource "cloudflare_record" "notify_MX_a" {
  name     = "notify.${var.homelab_main_domain}"
  type     = "MX"
  zone_id  = data.cloudflare_zones.homelab_main_domain.zones[0].id
  value    = "mxa.mailgun.org"
  priority = 10
}

resource "cloudflare_record" "notify_MX_b" {
  name     = "notify.${var.homelab_main_domain}"
  type     = "MX"
  zone_id  = data.cloudflare_zones.homelab_main_domain.zones[0].id
  value    = "mxb.mailgun.org"
  priority = 10
}
Powered by cgit v1.2.3 (git 2.41.0)