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