famous-television-87761
06/03/2024, 3:43 PMIf I do ain a file other thanpulumi.export
it seems like it gets ignored. I added__main__.py
statements to ensure that my<http://pulumi.info|pulumi.info>
functions are being called and they are. I also logged one of the values I'm exporting viapulumi.export
and it's a valid value. Why can't I export it from a function in another file?value.apply(lambda x: <http://pulumi.info|pulumi.info>(x))
miniature-musician-31262
06/04/2024, 3:44 PMapply
. (The call can be in another file, too, just not inside an apply
.)
I'll see if I can find a good explanation for why this is, and get it added to the docs also, but in the meantime, this may help:
https://gist.github.com/cnunciato/93dfba1036b7503270eefa498d122299famous-television-87761
06/04/2024, 3:48 PMapply
, but it is. I have to do a stack reference to get some outputs from another stack and a stack reference is an Output
so I resolve the stack reference and then apply
that into a fairly large function that does all the other work.
And that gist shows a good solution! Thanks.miniature-musician-31262
06/04/2024, 3:49 PMfamous-television-87761
06/04/2024, 4:39 PMapply
it works great. In my case I have several values to export so I had my function return a Dict[str, Any]
mapping the export name to the value I want exported. So when you call result = some_output.apply(some_function)
result
is now an Output[Dict[str, Any]]
which means you can't iterate over it like for k, v in result.items
to export each item individually. You can export the entire Dict however. But, in my case some of the values in result
are secrets and some are not. But due to how Pulumi works that means the entire Dict
is a secret so I can't see my outputs without pulumi stack output --show-secrets
. Not the end of the world, but the ability to actually export from an apply
would make this easier.