From 989b3531251aac0d929166285ffc1eea48016b26 Mon Sep 17 00:00:00 2001 From: Ricard Illa Date: Tue, 23 Aug 2022 17:16:47 +0200 Subject: [PATCH] namecheap: add ipv6 records --- namecheap.tf | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) 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 + } + } + }