Stashbox/dns.tf

72 lines
1.2 KiB
Terraform
Raw Normal View History

2023-01-01 07:50:03 +00:00
terraform {
required_providers {
namecheap = {
source = "namecheap/namecheap"
version = "~> 2.1.0"
}
}
2023-04-15 02:47:07 +00:00
backend "http" {}
2023-01-01 07:50:03 +00:00
}
provider "namecheap" {}
variable "stashbox_domain" {
2023-04-15 02:47:07 +00:00
type = string
default = "web.stash"
2023-04-15 02:47:07 +00:00
}
variable "stashbox_web_addr" {
2023-04-15 02:47:07 +00:00
type = string
default = "::db"
2023-04-15 02:47:07 +00:00
}
variable "stashbox_feed_addr" {
2023-04-15 02:47:07 +00:00
type = string
default = "::feed"
2023-04-15 02:47:07 +00:00
}
variable "stashbox_ip4_ext" {
2023-01-01 07:50:03 +00:00
type = string
default = "0.0.0.0"
2023-01-21 03:57:55 +00:00
}
resource "namecheap_domain_records" "stashbox" {
domain = var.stashbox_domain
2023-01-01 07:50:03 +00:00
record {
hostname = "www"
address = var.stashbox_web_addr
2023-01-21 03:57:55 +00:00
type = "AAAA"
ttl = 1799
2023-01-21 03:57:55 +00:00
}
record {
hostname = "www"
address = var.stashbox_ip4_ext
type = "A"
ttl = 1799
}
record {
hostname = "feed"
address = var.stashbox_feed_addr
2023-01-21 03:57:55 +00:00
type = "AAAA"
ttl = 1799
2023-01-01 07:50:03 +00:00
}
record {
hostname = "feed"
address = var.stashbox_ip4_ext
2023-01-21 03:57:55 +00:00
type = "A"
ttl = 1799
2023-01-21 03:57:55 +00:00
}
record {
hostname = "@"
address = "www.${var.stashbox_domain}."
type = "CNAME"
ttl = 1799
}
record {
hostname = "plex"
address = "feed.${var.stashbox_domain}."
type = "CNAME"
ttl = 1799
2023-01-21 03:57:55 +00:00
}
2023-01-01 07:50:03 +00:00
}