Stashbox/dns.tf

81 lines
1.3 KiB
HCL

terraform {
required_providers {
namecheap = {
source = "namecheap/namecheap"
version = "~> 2.1.0"
}
}
backend "http" {}
}
provider "namecheap" {}
variable "subnet" {
type = string
default = "fd00::"
}
variable "db_addr" {
type = string
default = "1"
}
variable "feed_addr" {
type = string
default = "2"
}
variable "db_ipv4_addr" {
type = string
default = "192.168.0.1"
}
variable "domain" {
type = string
default = "library.local"
}
variable "feed_subdomain_name" {
type = string
default = "feed"
}
variable "plex_subdomain_name" {
type = string
default = "plex"
}
resource "namecheap_domain_records" "othostash" {
domain = var.domain
record {
hostname = "@"
address = "${var.subnet}${var.db_addr}"
type = "AAAA"
}
record {
hostname = var.feed_subdomain_name
address = "${var.subnet}${var.feed_addr}"
type = "AAAA"
}
record {
hostname = "www"
address = var.domain
type = "CNAME"
}
record {
hostname = var.plex_subdomain_name
address = "${var.feed_subdomain_name}.${var.domain}"
type = "CNAME"
}
record {
hostname = "@"
address = var.db_ipv4_addr
type = "A"
}
record {
hostname = var.feed_subdomain_name
address = var.db_ipv4_addr
type = "A"
}
}