namecheap: make records a dynamic block

main
Ricard Illa 2022-08-23 17:07:05 +02:00
parent 41c01c003e
commit 682bdb708a
No known key found for this signature in database
GPG Key ID: F69A672B72E54902
1 changed files with 12 additions and 4 deletions

View File

@ -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
}
}
}