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" {}
variable "stash_domain" {
2023-04-15 02:47:07 +00:00
type = string
default = "web.stash"
2023-04-15 02:47:07 +00:00
}
variable "web_addr" {
2023-04-15 02:47:07 +00:00
type = string
default = "::db"
2023-04-15 02:47:07 +00:00
}
variable "feed_addr" {
type = string
default = "::feed"
2023-04-15 02:47:07 +00:00
}
variable "app_addr" {
2023-04-15 02:47:07 +00:00
type = string
default = "::beef"
2023-04-15 02:47:07 +00:00
}
variable "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" "stash" {
domain = var.stash_domain
2023-01-01 07:50:03 +00:00
record {
hostname = "www"
address = var.web_addr
2023-01-21 03:57:55 +00:00
type = "AAAA"
}
record {
hostname = "www"
address = var.ip4_ext
type = "A"
}
record {
hostname = "feed"
address = var.feed_addr
2023-01-21 03:57:55 +00:00
type = "AAAA"
2023-01-01 07:50:03 +00:00
}
record {
hostname = "feed"
address = var.ip4_ext
type = "A"
2023-01-21 03:57:55 +00:00
}
record {
hostname = "app"
address = var.app_addr
type = "AAAA"
2023-01-01 07:50:03 +00:00
}
2023-01-21 03:57:55 +00:00
record {
hostname = "app"
address = var.ip4_ext
2023-01-21 03:57:55 +00:00
type = "A"
}
record {
hostname = "@"
address = "www.${var.stash_domain}"
type = "CNAME"
}
record {
hostname = "plex"
address = "feed.${var.stash_domain}"
type = "CNAME"
2023-01-21 03:57:55 +00:00
}
2023-01-01 07:50:03 +00:00
}