Skip to content

Commit 8b57506

Browse files
jkodroffclaude
andauthored
Clarify that RegisterOutputs is mandatory for component resources (#15190)
- Change misleading language that presented RegisterOutputs as optional "best practice" - Add detailed explanation of RegisterOutputs functionality (marks component complete, saves outputs to state) - Include warning about serious consequences of not calling RegisterOutputs - Fix documentation to accurately reflect that RegisterOutputs must always be called 🤖 Generated with [Claude Code](https://claude.ai/code) Co-authored-by: Claude <[email protected]>
1 parent 835ff05 commit 8b57506

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

content/docs/iac/concepts/resources/components.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ class MyComponent extends ComponentResource {
256256

257257
## Registering Component Outputs
258258

259-
Component resources can define their own output properties by using register_outputs . The Pulumi engine uses this information to display the logical outputs of the component resource and any changes to those outputs will be shown during an update.
259+
Component resources can define their own output properties. Outputs in a component must be registered with the Pulumi IaC engine by calling `registerOutputs`. The Pulumi engine uses this information to display the logical outputs of the component resource and any changes to those outputs will be shown during an update.
260260

261261
For example, this code registers an S3 bucket's computed domain name, which won't be known until the bucket is created:
262262

@@ -415,7 +415,20 @@ class MyComponent extends ComponentResource {
415415

416416
The call to `registerOutputs` typically happens at the very end of the component resource's constructor.
417417

418-
The call to `registerOutputs` also tells Pulumi that the resource is done registering children and should be considered fully constructed, so—although it's not enforced—the best practice is to call it in all components even if no outputs need to be registered.
418+
### What RegisterOutputs Does
419+
420+
The `registerOutputs` call serves two critical functions:
421+
422+
1. **Marks the component as fully constructed**: It signals to the Pulumi engine that the component resource has finished registering all its child resources and should be considered complete.
423+
1. **Saves outputs to state**: It registers the component's outputs with the Pulumi engine so they are properly saved to the state file and can be referenced by other resources or exported from the stack.
424+
425+
{{% notes type="warning" %}}
426+
Failing to call `registerOutputs` could cause serious issues with your component resource:
427+
428+
- The component will appear as "creating..." indefinitely in the Pulumi Console
429+
- Outputs will not be saved to the state file, potentially causing data loss
430+
- The component lifecycle will not complete properly, which may affect dependency tracking and updates
431+
{{% /notes %}}
419432

420433
## Inheriting Resource Providers
421434

0 commit comments

Comments
 (0)