Stashbox/dns.tf

81 lines
1.3 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" {}
2023-04-15 02:47:07 +00:00
variable "subnet" {
type = string
2023-04-15 02:51:02 +00:00
default = "fd00"
2023-04-15 02:47:07 +00:00
}
variable "db_addr" {
type = string
2023-04-15 02:51:02 +00:00
default = "::1"
2023-04-15 02:47:07 +00:00
}
variable "feed_addr" {
type = string
2023-04-15 02:51:02 +00:00
default = "::2"
2023-04-15 02:47:07 +00:00
}
variable "db_ipv4_addr" {
type = string
default = "192.168.0.1"
}
variable "domain" {
2023-01-01 07:50:03 +00:00
type = string
2023-04-15 02:47:07 +00:00
default = "library.local"
2023-01-21 03:57:55 +00:00
}
2023-04-15 02:47:07 +00:00
variable "feed_subdomain_name" {
2023-01-21 03:57:55 +00:00
type = string
2023-04-15 02:47:07 +00:00
default = "feed"
}
variable "plex_subdomain_name" {
type = string
default = "plex"
2023-01-01 07:50:03 +00:00
}
resource "namecheap_domain_records" "othostash" {
2023-04-15 02:47:07 +00:00
domain = var.domain
2023-01-01 07:50:03 +00:00
record {
hostname = "@"
2023-04-15 02:47:07 +00:00
address = "${var.subnet}${var.db_addr}"
2023-01-21 03:57:55 +00:00
type = "AAAA"
}
record {
2023-04-15 02:47:07 +00:00
hostname = var.feed_subdomain_name
address = "${var.subnet}${var.feed_addr}"
2023-01-21 03:57:55 +00:00
type = "AAAA"
2023-01-01 07:50:03 +00:00
}
record {
hostname = "www"
2023-04-15 02:47:07 +00:00
address = var.domain
2023-01-21 03:57:55 +00:00
type = "CNAME"
}
record {
2023-04-15 02:47:07 +00:00
hostname = var.plex_subdomain_name
address = "${var.feed_subdomain_name}.${var.domain}"
2023-01-01 07:50:03 +00:00
type = "CNAME"
}
2023-01-21 03:57:55 +00:00
record {
hostname = "@"
2023-04-15 02:47:07 +00:00
address = var.db_ipv4_addr
2023-01-21 03:57:55 +00:00
type = "A"
}
record {
2023-04-15 02:47:07 +00:00
hostname = var.feed_subdomain_name
address = var.db_ipv4_addr
2023-01-21 03:57:55 +00:00
type = "A"
}
2023-01-01 07:50:03 +00:00
}