https://pulumi.com logo
Title
a

alert-glass-49407

10/06/2021, 8:22 PM
re: above thread, something I've been trying to work my head around today is passing outputs into a jinja2 template
βœ… 1
r

red-match-15116

10/06/2021, 8:26 PM
You will need to do that within the apply!
πŸ‘€ 1
If you have some example code I can maybe help point you in the right direction
a

alert-glass-49407

10/06/2021, 8:56 PM
I'm all set now, I was struggling originally because I was trying to do something like:
test = '''{{ some_value }}'''
jinja2.Template(test).render(
  some_value = pulumi_output.apply(lambda x: f"{x}"
))
and similar incantations, which was not working adjusting to treat the apply as the entrypoint e.g.
test = '''{{ some_value }}'''
pulumi_output.apply(
  lambda x: jinja2.Template(test).render(some_value=x))
works just fine πŸ™‚
πŸŽ‰ 1
πŸ˜›artypus-8bit: 1
b

billowy-army-68599

10/06/2021, 9:19 PM
hey Rob, is there any reason you don't want to use
apply
as the entrypoint? you have to do it that way, because
apply
basically means "wait for this value to resolve, then do something"
a

alert-glass-49407

10/06/2021, 9:23 PM
no reason I was just misunderstanding how it worked
mentally it was just like: 1. I put
some_value=pulumi_output
into the render call and my resulting string has the
__repr__
value in it 2. Ok, I'll swap that to
pulumi_output.apply()
,
.concat()
, etc., trying to find one that works 3. Try to search examples repository, don't find anything great immediately, post in slack πŸ™‚
My normal approach to this is to drop into a pdb session and start calling things interactively, but the Output objects are weird in that they just return other Output objects? I couldn't find a place to start debugging at where I could actually resolve them
b

billowy-army-68599

10/06/2021, 9:32 PM
a

alert-glass-49407

10/06/2021, 9:53 PM
will do thanks!
believe it or not I have no problem with promise.then(), for whatever reason the pulumi grammar just breaks my brain πŸ™‚
g

great-sunset-355

10/07/2021, 7:14 AM
Not only yours mate πŸ™‚ I usually have the same approach when I'm learning a new tool. Just drop into the debugger and see what I can touch. I suspect this happens because Pulumi promises that you can use the language of your choice but after that, you discover that you may be writing the language but Pulumi dictates how you write it. I find it difficult to adjust as well. I also believe if this can be fixed it will unleash the true potential Pulumi has. However it will probably take some time