hairyhenderson/gomplate

Provide a "cli command" datasource to allow custom integration with any external data source

MurzNN opened this issue ยท 3 comments

Will be good to implement a configurable "cli command" datasource, where we can configure a command to run to retrieve the value from a source.

Many secret storages provide a command line interface to retrieve the data, for example, Bitwarden has the bw cli interface to retrieve the data.

But implementing a separate datasource for each tool in the gomplate will be too wide task.

So, instead we can simply introduce a configurable datasource "command" where we can configure the template, and then - gomplate will just prepare the command, run it and parse the output, almost like with the current "file" datasource.

Something like this:

echo '{{ ds "bitwarden" "35ab2e78-7d47-49e5-b72f-d8c7cbc32531" "password"}}'| gomplate -d bitwarden=command://bw+get+{arg2}+{arg1}/data.{arg2}

What do you think about this idea?

@MurzNN Have you seen the plugin support already available? It's not a datasource, but IMO it provides a better interface for your purposes:

$ echo '{{ bitwarden "35ab2e78-7d47-49e5-b72f-d8c7cbc32531" "password" }}' | gomplate --plugin=bitwarden=bw.sh
...

Can't tell for @MurzNN case, but was looking for a way to use it with SOPS and this plugin interface suits mine perfectly ๐Ÿ‘Œ

@hairyhenderson, thanks for the workaround, it works well!