for exmaple
public_ip = get_env(“static_ip”, “[“3.20.2.4”]”)
didn’t work ? how can I pass in a list of ip’s
for exmaple
public_ip = get_env(“static_ip”, “[“3.20.2.4”]”)
didn’t work ? how can I pass in a list of ip’s
Hi Buamod,
The canonical way to handle this is to use json for the environment variables, and then you can use the jsondecode
function to convert the environment variable string to an HCL list.
E.g:
public_ip = jsondecode(get_env(“static_ip”, “[“3.20.2.4”]”))
Best regards,
Yori
sorry @yoriy but it didn’t work …I tried it when pass a list of security groups but if failed
secGroup = get_env(“security groups”, "[“sg-123121, sg-1231231, sg-12312312]”)
It needs to be valid json for it to work. You’re missing a few quotes there. It should be:
secGroup = get_env("security groups", "[\"sg-123121\", \"sg-1231231\", \"sg-12312312\"]”