hairyhenderson/gomplate

Process datasources as templates before the final template

tiawl opened this issue · 0 comments

Hi,

I'm currently using the 3.11.7 version for homemade scripts. I am using it with some YAML datasources. I am facing a recurrent issue and maybe I am missing something in the documentation.
Because I am not so proud of my issue title I think that explaining it with an exemple is a better idea.

Suppose I have this YAML datasource:

---
# awesome.yaml

my_awesome_map:
  first: 'this string is awesome'
  second: '{{ (datasource "awesome".my_awesome_map).first }}ly awesome'

...

when using this command line:

gomplate --datasource awesome=awesome.yaml --in '{{ (datasource "awesome".my_awesome_map).second }}'

It is printing:

{{ (datasource "awesome".my_awesome_map).first }}ly awesome

Which is indeniably correct.
However what I am expecting is:

this string is awesomely awesome

Currently, the solution I have is to use gomplate to resolve the awesome.yaml file with itself as datasource before. But I have to repeat this operation for each dependencies in my datasources.

Does it exist a way to make gomplate prints the result I am expecting with a unique execution ? If not, do you think it is something that we can see in the gomplate roadmap?

Thank you for this awesome tool.