diff --git a/namecheap.tf b/namecheap.tf index af07255..8141130 100644 --- a/namecheap.tf +++ b/namecheap.tf @@ -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 + } + } + }