I have a .tftpl file that will be used for various different purposes. Each purpose will need to pass in different variables and have slightly different content. I’m wondering if there’s a way that I can call templatefile() and only pass the vars that I need for a single purpose? This is opposed to calling templatefile() and passing every var every time, whether that purpose requires it or not.
I’m trying to do something like this with my .tftpl file:
${ if try(var1,"false") == "true" }
use ${var1} in some way
${ endif }
${ if try(var2,"false") == "true" }
use ${var2} in some way
${ endif }
etc.
However, if I only specify var1, and not var2, to the templatefile() function, then I get an error similar to this: Invalid value for “vars” parameter: vars map does not contain key “var2”