diff --git a/modules/opentelekomcloud-csv-to-dns/README.md b/modules/opentelekomcloud-csv-to-dns/README.md index 8715a37..8898936 100644 --- a/modules/opentelekomcloud-csv-to-dns/README.md +++ b/modules/opentelekomcloud-csv-to-dns/README.md @@ -12,7 +12,7 @@ No modules. | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| -| [csv\_file\_path](#input\_csv\_file\_path) | Path to the CSV file containing the records to create, expected fields are domain, type and record. | `string` | n/a | yes | +| [csv\_file\_path](#input\_csv\_file\_path) | 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. | `string` | n/a | yes | | [zone\_id](#input\_zone\_id) | OTC DNS zone ID. | `string` | n/a | yes | ## Outputs 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" {