Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Processing mixed outputs between custom path & output-dir #2051

Open
RafPe opened this issue Apr 20, 2024 · 0 comments
Open

Processing mixed outputs between custom path & output-dir #2051

RafPe opened this issue Apr 20, 2024 · 0 comments

Comments

@RafPe
Copy link

RafPe commented Apr 20, 2024

Looking for some inisghts on controlling outputs of templating mix between templated files and dynamic outputs from templates.

For ease of example lets assume I have the following example.t file

Hello  {{ . }} 

I then have the following structure of folders/files for my template to be rendered from. Lets say I run it from /base/template/input

.
├── dynamic.tmpl
├── content_foo.txt
└── content_bar.tf

in the dynamic.tmpl I have the following setup

{{- range $hello_name := .mycontext.some_range_of_inputs }}
{{- $outPath := printf "hello.%s.txt" $hello_name }}
{{- tmpl.Exec "hello" $hello_name | file.Write $outPath }}
{{- end }}

Now the problem I am trying to solve is to be able to template the outputs from /base/template/input into lets say /results/output. Rigjt now however I struggle with the fact of how to pass the --output-dir context into the dynamic templates and how not to include that file in the final results of the templating :) ? So the expected result is

.
├── hello_bar.txt
├── hello_xyz.txt
├── hello_abc.txt
├── content_foo.txt
└── content_bar.tf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant