https://pulumi.com logo
#python
Title
f

fierce-ability-58936

12/10/2020, 10:28 PM
Tried to ask in #general but nobody answered. Maybe because it’s Python-specific. https://pulumi-community.slack.com/archives/C84L4E3N1/p1607374013212500 So what does “register_outputs()” actually do? I would expect it to create Output properties with the dict content. Sorry, not really clear in the docs.
g

gentle-diamond-70147

12/10/2020, 10:49 PM
You're correct - it is a bit confusing and not well-documented. The primary function of
register_outputs()
is to register that your component is "done" to the Pulumi engine. This is necessary for Pulumi to handle dependencies of your component correctly. You do still need member variables on the component itself to use its outputs in other places in your Pulumi application - e.g. https://github.com/pulumi/examples/blob/f0732dc6314636f48a88b4ac4da55e3187b1def4/kubernetes-py-jenkins/jenkins.py#L213.
f

fierce-ability-58936

12/10/2020, 11:29 PM
Oh thank you. So I’ve seen people using it as
register_outputs({})
without listing the actual outputs. Apparently, it works for them. Then what difference does it make to specify output properties in this function call?
g

gentle-diamond-70147

12/10/2020, 11:30 PM
TBH, I'm not 100% sure.
r

rough-oxygen-8318

12/14/2020, 4:50 PM
@gentle-diamond-70147
...is to register that your component is "done"
What would be a best practice if my component has multiple resources? e.g.: A custom component that creates a security_group & ec2 instance... should I register at least 1 output for both resources? 🤔