Apologies for the re-post but I never got a reply ...
# general
Apologies for the re-post but I never got a reply and I'm still interested:
If I do a
in a file other than
it seems like it gets ignored. I added
statements to ensure that my
functions are being called and they are. I also logged one of the values I'm exporting via
value.apply(lambda x: <http://pulumi.info|pulumi.info>(x))
and it's a valid value. Why can't I export it from a function in another file?
I think I've seen this before and been confused by it also. I'm not sure why technically, but the call to export does need to happen outside of
. (The call can be in another file, too, just not inside an
.) 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/93dfba1036b7503270eefa498d122299
Ah! I didn't realize mine was happening inside an
, but it is. I have to do a stack reference to get some outputs from another stack and a stack reference is an
so I resolve the stack reference and then
that into a fairly large function that does all the other work. And that gist shows a good solution! Thanks.
You bet! Thanks for calling it out too -- good thing to get into the docs for sure.
Hmmm... The workaround works but has limitations. If you want to export just a single value from the function you called via
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)
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
are secrets and some are not. But due to how Pulumi works that means the entire
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
would make this easier.