If you’re on 0.7.0 you can use native lists.
So, if your access_ip’s are defined like so in your vars file…
access_ips = [“1.1.1.1”, “2.2.2.2”, “3.3.3.3”]
Then you can just pass the list to the module so that you don’t have to split them again. Make sure you declare the variable as type=list.
variable "access_ips
" { type = "list" }
You can access them inside the module in whatever resource you need it in and iterate through the list if it supports “count"….
resource “null_resource” "my resource" {
count = “3”
…
provisioner “local-exec" {
command = “echo ${access_ips[count.index]} > /dev/null"
}
…
}
Using lists avoids having to use whole join/split workaround that was necessary prior to 0.7.0.
Here’s a link to the git PR that implements native lists for more info...