hosts variable containing all hosts IPs

main
Ricard Illa 2022-08-23 18:22:40 +02:00
parent 86b7f5d543
commit dc48207c55
No known key found for this signature in database
GPG Key ID: F69A672B72E54902
1 changed files with 18 additions and 25 deletions

View File

@ -1,24 +1,17 @@
// https://registry.terraform.io/providers/namecheap/namecheap/latest/docs // https://registry.terraform.io/providers/namecheap/namecheap/latest/docs
variable "caladan-ips" { variable "hosts" {
type = object({
v4 = string
v6 = string
})
default = { default = {
v4 = "139.162.137.29" // Alpine VPS hosted on Linode
v6 = "2a01:7e01::f03c:92ff:fea2:5d7c" caladan = {
} v4 = "139.162.137.29"
} v6 = "2a01:7e01::f03c:92ff:fea2:5d7c"
}
variable "fugu-ips" { // OpenBSD VPS hosted on Vultr
type = object({ fugu = {
v4 = string v4 = "217.69.5.52"
v6 = string v6 = "2001:19f0:6801:1d34:5400:03ff:fe18:7588"
}) }
default = {
v4 = "217.69.5.52"
v6 = "2001:19f0:6801:1d34:5400:03ff:fe18:7588"
} }
} }
@ -98,7 +91,7 @@ variable "sloth-hostnames" {
provider "namecheap" { provider "namecheap" {
user_name = "gthar" user_name = "gthar"
api_user = "gthar" api_user = "gthar"
client_ip = var.caladan-ips.v4 client_ip = var.hosts.caladan.v4
use_sandbox = false use_sandbox = false
} }
@ -111,7 +104,7 @@ resource "namecheap_domain_records" "monotremata-xyz" {
content { content {
hostname = record.value hostname = record.value
type = "A" type = "A"
address = var.caladan-ips.v4 address = var.hosts.caladan.v4
} }
} }
@ -120,7 +113,7 @@ resource "namecheap_domain_records" "monotremata-xyz" {
content { content {
hostname = record.value hostname = record.value
type = "A" type = "A"
address = var.caladan-ips.v4 address = var.hosts.caladan.v4
} }
} }
@ -129,7 +122,7 @@ resource "namecheap_domain_records" "monotremata-xyz" {
content { content {
hostname = record.value hostname = record.value
type = "A" type = "A"
address = var.caladan-ips.v4 address = var.hosts.caladan.v4
} }
} }
@ -138,20 +131,20 @@ resource "namecheap_domain_records" "monotremata-xyz" {
content { content {
hostname = record.value hostname = record.value
type = "AAAA" type = "AAAA"
address = var.caladan-ips.v6 address = var.hosts.caladan.v6
} }
} }
record { record {
hostname = "mail" hostname = "mail"
type = "A" type = "A"
address = var.fugu-ips.v4 address = var.hosts.fugu.v4
} }
record { record {
hostname = "mail" hostname = "mail"
type = "AAAA" type = "AAAA"
address = var.fugu-ips.v6 address = var.hosts.fugu.v6
} }
record { record {