I have a requirement to use variables to set notification emails to a list of people in Terraform to shut down a resource. However, the emails to be sent are required to combine three declared variables, so the module will look something like the below:
notification_settings {
enabled = true
time_in_minutes = "180"
email = format("%s", "${var.config.person1};${var.config.person2};${var.config.person3}")
}
Any ideas or suggestions would be helpful on how to do this.
CodePudding user response:
This should be changed from:
email = format("%s", "${var.config.person1};${var.config.person2};${var.config.person3}")
to:
email = format("%s;%s;%s", var.config.person1, var.config.person2, var.config.person3)
More information on format
function can be found in [1].
[1] https://www.terraform.io/language/functions/format
CodePudding user response:
I did something similar but it looks like this:
notification_settings {
enabled = true
time_in_minutes = "120"
email = "${var.person1};${var.person2};${var.person3}"
}
Also, check your time in minutes setting if your using the azurerm_dev_test_global_vm_shutdown_schedule resource you can't extend the shutdown event beyond 120 minutes.