feat: inject cli state values (--state-values-set) into environment templating context (#1917)

* feat: inject cli state values (--state-values-set) into environment templating context

Signed-off-by: Vincent Chenal <vincent.chenal@protonmail.com>

* test: added envvals_loader unit test for environment values

Signed-off-by: Vincent Chenal <vincent.chenal@protonmail.com>

* test: added 'state values set cli args in environments' integration test

Signed-off-by: Vincent Chenal <vincent.chenal@protonmail.com>

* fix: merge environments before loadValuesEntries

Signed-off-by: Vincent Chenal <vincent.chenal@protonmail.com>

* fix: 'state values set cli args in environments' integration test

Signed-off-by: Vincent Chenal <vincent.chenal@protonmail.com>

---------

Signed-off-by: Vincent Chenal <vincent.chenal@protonmail.com>
This commit is contained in:
Vince-Chenal
2025-02-14 20:49:07 +08:00
committed by GitHub
parent 0d863b3c05
commit e33b4725ea
10 changed files with 69 additions and 2 deletions
+1 -1
View File
@@ -65,7 +65,7 @@ func (ld *EnvironmentValuesLoader) LoadEnvironmentValues(missingFileHandler *str
if strings.HasSuffix(f, ".hcl") {
hclLoader.AddFile(f)
} else {
tmplData := NewEnvironmentTemplateData(env, "", map[string]any{})
tmplData := NewEnvironmentTemplateData(env, "", env.Values)
r := tmpl.NewFileRenderer(ld.fs, filepath.Dir(f), tmplData)
bytes, err := r.RenderToBytes(f)
if err != nil {