Call to function “templatefile” failed: ./files/kubernetes/userdata.tpl:44,1-1: Unterminated template string; No closing marker was found for the string…
HOWEVER, heredocs are strings - but what you’re trying to put inside your heredoc is not a string - it’s another piece of Terraform expression language!
This means that even if you get your heredoc syntax correct, it’s still not a working solution to the problem you present here.
You’re using true there just as an example, right? There’s no particular logic to it, I’m guessing. I should be able to use can(regex("^kube-.+", node_name) instead, I suppose?
So I test if the node_name starts with “kube”, it writes the content of that file, and concat makes sure that it’s another item of the list write_files. If I don’t use concat, I see that it adds yet another dash, so it’s as if it defined a separate list.
Rather complicated, but I appreciate it I just need to weigh things and how I can make the code as succinct as possible while also keeping it easily legible.