sops icon indicating copy to clipboard operation
sops copied to clipboard

Support render template

Open wenerme opened this issue 2 years ago • 2 comments

the whole encrypted sops may contain a lot of secrets, but most of time only need piece of it, hope sops support some template render function, like

create user test login password '{{.pg.users.test.password}}';
sops secrets.yaml --output template=in.sql > out.sql

the out.sql should be

create user test login password 'xyz';

This can also used as inline template

sops secrets.yaml -o go-template="create user test login password '{{.pg.users.test.password}}';"  > out.sql

The output should be the same

wenerme avatar Nov 20 '22 13:11 wenerme

This feature would be appreciated.

arisrais avatar Nov 23 '23 15:11 arisrais

Please note that there is already --extract to get hold of single values (https://github.com/getsops/sops/blob/main/README.rst#45extract-a-sub-part-of-a-document-tree). This solves the use-cases shown in the original question. Obviously that doesn't allow more complex templating, but this is already useful for quite a few situations.

felixfontein avatar Nov 23 '23 17:11 felixfontein