Skip to content

registerOutputs usage is not clear #18007

@melbourne2991

Description

@melbourne2991

I'm a bit confused about the registerOutputs call and what actually is considered an output.
The current documentation says this:

Components can define their own properties using registerOutputs. The Pulumi engine uses this information to display the logical outputs of the component. The call to registerOutputs also tells Pulumi that the resource is done registering children and should be considered fully constructed, so it is recommended that this method be called in all components even if no outputs need to be registered.

That seems to imply that to expose properties you should use registerOutputs. But looking at the source code there are many instances of properties being exposed, yet registerOutputs is called with nothing, or an empty object:

https://github.com/pulumi/pulumi-awsx/blob/88f9bbc90758b08515945d0b93c6cf0a3a24e481/nodejs/awsx/ec2/internetGateway.ts

It seems to me registerOutputs does two things, it signifies that the resource is done being created (as the docs say) and IF you pass something to it and that resource is a top level export Pulumi will only display the registered output properties in the cli/ui.

If passing outputs to it is purely a means of exposing data to the UI/CLI and has no bearing on anything else it may be helpful for the docs to be a bit clearer on that. Maybe rewording it like this (assuming my understanding is correct):

Components can expose properties to the UI and CLI by calling registerOutputs. The call to registerOutputs also tells Pulumi that the resource is done registering children and should be considered fully constructed, so it is recommended that this method be called in all components even if no outputs need to be registered.

Metadata

Metadata

Assignees

Labels

area/docsImprovements or additions to documentationkind/enhancementImprovements or new featuresneeds-triageNeeds attention from the triage teamresolution/fixedThis issue was fixed
No fields configured for Enhancement.

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions