You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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]>
Copy file name to clipboardExpand all lines: content/docs/iac/concepts/resources/components.md
+15-2Lines changed: 15 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -256,7 +256,7 @@ class MyComponent extends ComponentResource {
256
256
257
257
## Registering Component Outputs
258
258
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.
260
260
261
261
For example, this code registers an S3 bucket's computed domain name, which won't be known until the bucket is created:
262
262
@@ -415,7 +415,20 @@ class MyComponent extends ComponentResource {
415
415
416
416
The call to `registerOutputs` typically happens at the very end of the component resource's constructor.
417
417
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
0 commit comments