Stashbox/dns.tf

72 lines
1.2 KiB
HCL

terraform {
required_providers {
namecheap = {
source = "namecheap/namecheap"
version = "~> 2.1.0"
}
}
backend "http" {}
}
provider "namecheap" {}
variable "stashbox_domain" {
type = string
default = "web.stash"
}
variable "stashbox_web_addr" {
type = string
default = "::db"
}
variable "stashbox_feed_addr" {
type = string
default = "::feed"
}
variable "stashbox_ip4_ext" {
type = string
default = "0.0.0.0"
}
resource "namecheap_domain_records" "stashbox" {
domain = var.stashbox_domain
record {
hostname = "www"
address = var.stashbox_web_addr
type = "AAAA"
ttl = 1799
}
record {
hostname = "www"
address = var.stashbox_ip4_ext
type = "A"
ttl = 1799
}
record {
hostname = "feed"
address = var.stashbox_feed_addr
type = "AAAA"
ttl = 1799
}
record {
hostname = "feed"
address = var.stashbox_ip4_ext
type = "A"
ttl = 1799
}
record {
hostname = "@"
address = "www.${var.stashbox_domain}."
type = "CNAME"
ttl = 1799
}
record {
hostname = "plex"
address = "feed.${var.stashbox_domain}."
type = "CNAME"
ttl = 1799
}
}