namecheap: add ipv6 records

main
Ricard Illa 2022-08-23 17:16:47 +02:00
parent 682bdb708a
commit 989b353125
No known key found for this signature in database
GPG Key ID: F69A672B72E54902
1 changed files with 21 additions and 5 deletions

View File

@ -1,8 +1,14 @@
// https://registry.terraform.io/providers/namecheap/namecheap/latest/docs
variable "caladan-ip" {
type = string
default = "139.162.137.29"
variable "caladan-ips" {
type = object({
v4 = string
v6 = string
})
default = {
v4 = "139.162.137.29"
v6 = "2a01:7e01::f03c:92ff:fea2:5d7c"
}
}
variable "caladan-hostnames" {
@ -13,7 +19,7 @@ variable "caladan-hostnames" {
provider "namecheap" {
user_name = "gthar"
api_user = "gthar"
client_ip = var.caladan-ip
client_ip = var.caladan-ips.v4
use_sandbox = false
}
@ -26,7 +32,17 @@ resource "namecheap_domain_records" "monotremata-xyz" {
content {
hostname = record.value
type = "A"
address = var.caladan-ip
address = var.caladan-ips.v4
}
}
dynamic "record" {
for_each = var.caladan-hostnames
content {
hostname = record.value
type = "AAAA"
address = var.caladan-ips.v6
}
}
}