Hi Erwin,

Nested lookups are possible.

We did a blog post on this topic:
https://blog.example42.com/2020/01/21/hiera-nested-lookups/ 
<https://blog.example42.com/2020/01/21/hiera-nested-lookups/>

Just be sure:

A nested lookup (like in your example) always returns a string.
If you need arrays or hashes within a nested lookup you must use the alias 
function.

hth,
Martin

> On 18. May 2021, at 10:23, Erwin Bogaard <[email protected]> wrote:
> 
> Hi,
> 
> I've been looking for this for a ling time, but can't find a definitive 
> answer to my question: is it possible to use a lookup in a lookup?
> 
> For example:
> aaa::bbb: 
> "mvn:com.xxx.bus/xxx-features/%{lookup('xxx::apps::env_hash.%{lookup('xxx::apps::env')}.yyy.version')}/xml/features"
> 
> Should lead to the following string:
> "mvn:com.xxx.bus/xxx-features/2.0.4/xml/features"
> 
> If "xxx::apps::env" has the value 'test'.
> And "xxx::apps::env_hash.test.yyy.version" has the value '2.0.4'.
> 
> The idea is that I would like one variable, "xxx::apps::env", make it 
> possible to switch in a hash from the 'test'-branch to the 'prod'-branch, for 
> example. Where each branch in that hash contains certain specified different 
> versions and/or other variables.
> 
> Thanks!
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/puppet-users/5068271c-bac1-4beb-b097-91803dbf3e2en%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/puppet-users/5068271c-bac1-4beb-b097-91803dbf3e2en%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/BFCDA3D6-80FA-4BFA-8E94-475F62A3A362%40gmail.com.

Reply via email to