You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I find the behaviour strange when comparing it with the documentation. Also, we are merging variables in the varfile with project-level, but we are not merging variables in the module-level with project-level.
% garden build -f -l3
ℹ vars → [echo]: foo bar
✔ vars → [echo]: foo bar → Done (took 0 sec)
% garden build -f --env varfile
Failed resolving one or more modules:
vars: Invalid template string (${var.one.config.foo}): Attempted to look up key "config" on a string.
% garden build -f --env varfile-yml -l3
ℹ vars → [echo]: baz bar
✔ vars → [echo]: baz bar → Done (took 0 sec)
% garden build -f --env varfile-yml-obj -l3
ℹ vars → [echo]: foo bar
✔ vars → [echo]: foo bar → Done (took 0 sec)
% garden build -f --env varfile-yml-empty -l3
Failed resolving one or more modules:
vars: Invalid template string (${var.one.config.foo}): Attempted to look up key "foo" on a object.
Compare this to the behaviour when uncommenting the variables in module.garden.yml
% garden build -f -l3
ℹ graph → Resolving 1 modules...
Failed resolving one or more modules:
vars: Invalid template string (${var.one.config.foo}): Could not find key bar under var.one.config. Available keys: foo.
Expected behavior
Clear and consistent variable precendence behaviour that can be explained in a few sentences without ambiguity
Especially if we allow merging vars from variable files with project-level vars, I think we should also allow merge of module-level vars with project-level vars.
Workaround
Suggested solution(s)
Additional context
Your environment
garden version0.12.48-edge-2d8bf03e5
The text was updated successfully, but these errors were encountered:
I have the problem that for an action I have to specify a necessary varfile for injecting a secret (which is handled automatically in my exec provider), but there is also a site-configurable aspect I want to have in another varfile.
My options are:
add it to the secret varfile e.g. _tls.yaml
add another varfile and require it always be there (not good since defaults are set in my action already)
always use the --var command (this quickly becomes impractical in interactive work, e.g garden deploy --var a=1 thing; garden test test-thing will redeploy thing without the vars)
Bug
According to https://docs.garden.io/using-garden/variables-and-templating#module-variables we have a clear variable precedence, but we also have some merge behaviour that we explain by linking to an RFC (Can we also have some examples?)
I find the behaviour strange when comparing it with the documentation. Also, we are merging variables in the varfile with project-level, but we are not merging variables in the module-level with project-level.
Reproducible example
project.garden.yml
varfile
varfile.yml
varfile-empty.yml
varfile-obj.yml
module.garden.yml
Current Behavior
Compare this to the behaviour when uncommenting the variables in
module.garden.yml
% garden build -f -l3 ℹ graph → Resolving 1 modules... Failed resolving one or more modules: vars: Invalid template string (${var.one.config.foo}): Could not find key bar under var.one.config. Available keys: foo.
Expected behavior
Clear and consistent variable precendence behaviour that can be explained in a few sentences without ambiguity
Especially if we allow merging vars from variable files with project-level vars, I think we should also allow merge of module-level vars with project-level vars.
Workaround
Suggested solution(s)
Additional context
Your environment
garden version
0.12.48-edge-2d8bf03e5
The text was updated successfully, but these errors were encountered: