From 682bdb708a82b23c798c4dc7f9cd5557d0a8b8c2 Mon Sep 17 00:00:00 2001 From: Ricard Illa Date: Tue, 23 Aug 2022 17:07:05 +0200 Subject: [PATCH] namecheap: make records a dynamic block --- namecheap.tf | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/namecheap.tf b/namecheap.tf index 64af1c2..af07255 100644 --- a/namecheap.tf +++ b/namecheap.tf @@ -5,6 +5,11 @@ variable "caladan-ip" { default = "139.162.137.29" } +variable "caladan-hostnames" { + type = set(string) + default = ["@"] +} + provider "namecheap" { user_name = "gthar" api_user = "gthar" @@ -16,9 +21,12 @@ resource "namecheap_domain_records" "monotremata-xyz" { domain = "monotremata.xyz" mode = "MERGE" // maybe eventually move to OVERWRITE - record { - hostname = "@" - type = "A" - address = var.caladan-ip + dynamic "record" { + for_each = var.caladan-hostnames + content { + hostname = record.value + type = "A" + address = var.caladan-ip + } } }