Hello. Brand new to Pulumi as of yesterday. I'm tr...
# python
Hello. Brand new to Pulumi as of yesterday. I'm trying it out with Python since the Golang support hasn't fully landed yet. Is there a way I can get the value of an Output as a Python primitive? I'm trying to pass one to
and it's not working since it's a
and not a bytes-like object.
I trying casting it to a string with
and that didn't work.
I also couldn't drop into a pdb debugger to inspect the thing. 😕
This is on a single Stack or are you referencing from another Stack?
If it's within a single Stack you need to use the
function on the
object. For example:
bastion_ip = bastion.private_ip.apply(lambda foo: '%s/32' % foo)
Thanks, that worked right away.
The docs suggest that the output of
is another
, which is why I hadn't tried it yet: https://www.pulumi.com/docs/intro/concepts/programming-model/#outputs
The result of the call to apply is a new Output whose value is the value returned from the callback, and which includes the dependencies of the original Output.
Yeah, it is not terribly intuitive, but it's an almost direct port from JavaScript
You need to use the Lambda as a callback function in order to access the data you want