hairyhenderson / gomplate

A flexible commandline tool for template rendering. Supports lots of local and remote datasources.
https://gomplate.ca
MIT License
2.73k stars 187 forks source link

Template to process from remote datasource (such as aws+ssm) #963

Closed hongkongkiwi closed 1 year ago

hongkongkiwi commented 4 years ago

I read the documentation but couldn't quite figure the answer to my question.

What I would like to do is to store the complete template in AWS SSM Parameter Store. Inside the template is the datasources etc. This way I can use the standard gomplate docker and keep the template easily updatable.

The template is then output to an application specific config file.

Is there a way to dynamically grab the template itself? Then process the downloaded template.

hongkongkiwi commented 4 years ago

To answer my own question, I just saw that you can pass the template via stdin, so for now the way to accomplish my goal is to run gomplate to pull the template, then pass that to another instance of gomplate. e.g. gomplate...... | gomplate

I think this way should work, but am I missing a flag that allows doing this with one instance of gomplate?

hairyhenderson commented 4 years ago

Hi @hongkongkiwi, thanks for logging this!

Interestingly, a similar idea came up in Slack today 😉. This is also related to #589.

I'm definitely open to doing this, and this recent interest is good motivation to work on it soon 😉

You could also work around this for now by treating the input template as a datasource instead, like this:

$ gomplate -d mytemplate=aws+ssm://whatever... -i '{{ include "mytemplate" | tmpl.Inline }}'

See https://docs.gomplate.ca/functions/data/#include and https://docs.gomplate.ca/functions/tmpl/#tmpl-inline for the docs on those functions.

hongkongkiwi commented 4 years ago

That's a great workaround thank you.

github-actions[bot] commented 1 year ago

This issue is stale because it has been open for 60 days with no activity. Remove stale label or comment or this will be automatically closed in a few days.

hairyhenderson commented 1 year ago

No movement has happened here yet, but it's still valid. Once #1336 is completed, this will automatically be accomplished.

github-actions[bot] commented 1 year ago

This issue is stale because it has been open for 60 days with no activity. Remove stale label or comment or this will be automatically closed in a few days.

github-actions[bot] commented 1 year ago

This issue is stale because it has been open for 60 days with no activity. If it is no longer relevant or necessary, please close it. Given no action, it will be closed in 14 days.

If it's still relevant, one of the following will remove the stale marking: