From f4be5567bca4835f7901328e75cfcd034230e6c3 Mon Sep 17 00:00:00 2001 From: simoncolincap Date: Wed, 11 Oct 2023 06:27:55 +0000 Subject: [PATCH] OPS-5263 Add support for multiple records and description --- modules/opentelekomcloud-csv-to-dns/main.tf | 3 ++- modules/opentelekomcloud-csv-to-dns/variables.tf | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/opentelekomcloud-csv-to-dns/main.tf b/modules/opentelekomcloud-csv-to-dns/main.tf index 9238d30..17735a9 100644 --- a/modules/opentelekomcloud-csv-to-dns/main.tf +++ b/modules/opentelekomcloud-csv-to-dns/main.tf @@ -7,7 +7,8 @@ resource "opentelekomcloud_dns_recordset_v2" "records" { ttl = 300 type = each.value.type # txt records have a max length of 255 characters - records = [replace(each.value.record, "/(.{255})/", "$1\" \"")] + records = [ for record in split("|", each.value.record) : replace(record, "/(.{255})/", "$1\" \"")] + description = each.value.description lifecycle { ignore_changes = [zone_id] diff --git a/modules/opentelekomcloud-csv-to-dns/variables.tf b/modules/opentelekomcloud-csv-to-dns/variables.tf index 72c97dd..45d29a4 100644 --- a/modules/opentelekomcloud-csv-to-dns/variables.tf +++ b/modules/opentelekomcloud-csv-to-dns/variables.tf @@ -1,6 +1,6 @@ variable "csv_file_path" { type = string - description = "Path to the CSV file containing the records to create, expected fields are domain, type and record." + description = "Path to the CSV file containing the records to create, expected fields are domain, type, record and description (can be empty). Multiple records can be separated using a pipe (|) character." } variable "zone_id" {