Hello,
I have a variable called: email
variable "prod_ops_email_recipients" {
type = list(string)
default = [ "email_address_1@com","email_address_2@com" ]
}
I used join function and format to have an array
locals {
user_email = [join(", ", [for s in var.prod_ops_email_recipients : format("%q", s)])]
}
resource "sumologic_content" "test_email" {
parent_id = "000000000157AD40"
config = templatefile("${path.root}/template/test_email.json",
{
email = local.user_email.*.id
})
}
I see in terraform console that is the expected output
> [join(", ", [for s in var.prod_ops_email_recipients : format("%q", s)])]
[
"\"email_address_2@com\", \"email_address_2@com\"",
]
However, I would like to pass in the following variable email with all both values to the following json (on field “toList”)
------ output omitted ---------------
"notification": {
"taskType": "EmailSearchNotificationSyncDefinition",
**"toList": "${email}",**
"subjectTemplate": "Subject",
"includeQuery": true,
"includeResultSet": true,
------ output omitted ---------------
At the end I would like to have something like:
“toList”: "[
“email_address_2@com”, “email_address_2@com”,
],