terraform { required_providers { namecheap = { source = "namecheap/namecheap" version = "~> 2.1.0" } } backend "http" {} } provider "namecheap" {} variable "stashbox_ip4_ext" { type = string default = "0.0.0.0" } variable "stashbox_domain" { type = string default = "web.stash" } variable "stashapp_addr" { type = string default = "::2" } variable "stashapp_domain" { type = string default = "app.stash" } variable "stashapp_notes_domain" { type = string default = "notes.stash" } resource "namecheap_domain_records" "stash" { domain = var.stashbox_domain record { hostname = "app" address = var.stashapp_addr type = "AAAA" ttl = 1799 } record { hostname = "app" address = var.stashbox_ip4_ext type = "A" ttl = 1799 } record { hostname = "clippings" address = var.stashapp_domain type = "CNAME" } record { hostname = "browse" address = var.stashapp_domain type = "CNAME" } } resource "namecheap_domain_records" "notes" { domain = var.stashapp_notes_domain record { hostname = "www" address = var.stashapp_addr type = "AAAA" } record { hostname = "www" address = var.stashbox_ip4_ext type = "A" } record { hostname = "@" type = "CNAME" address = "www.${var.stashapp_notes_domain}" } }