Skip to content

Pulumi ComponentResource Children Not Created

DodaTech Updated 2026-06-24 2 min read

In this tutorial, you'll learn about Pulumi ComponentResource Children Not Created. We cover key concepts, practical examples, and best practices.

A Pulumi ComponentResource children are not created or the component returns unexpected outputs.

Wrong ❌

// Wrong: ComponentResource without registering children
export class MyComponent extends pulumi.ComponentResource {
  constructor(name: string, opts?: pulumi.ComponentResourceOptions) {
    super("my:component:MyComponent", name, {}, opts);

    // Children created without proper parent/child relationship
    const bucket = new aws.s3.Bucket(`${name}-bucket`);
    const queue = new aws.sqs.Queue(`${name}-queue`);
  }
}

Wrong Output

pulumi preview
  + aws:s3:Bucket "my-bucket"
  + aws:sqs:Queue "my-queue"
# Note: resources are not nested under the component in the state
# They appear as top-level resources
export class MyComponent extends pulumi.ComponentResource {
  public readonly bucket: aws.s3.Bucket;
  public readonly queue: aws.sqs.Queue;

  constructor(name: string, opts?: pulumi.ComponentResourceOptions) {
    const defaults = { parent: this };
    super("my:component:MyComponent", name, {}, { ...opts, ...defaults });

    // Children created with parent reference
    this.bucket = new aws.s3.Bucket(`${name}-bucket`, {}, { parent: this });
    this.queue = new aws.sqs.Queue(`${name}-queue`, {}, { parent: this });

    // Register outputs
    this.registerOutputs({
      bucketName: this.bucket.bucketName,
      queueUrl: this.queue.url,
    });
  }
}

Right Output

pulumi preview
  + my:component:MyComponent "my-infra"
      + aws:s3:Bucket "my-infra-bucket"
      + aws:sqs:Queue "my-infra-queue"
Outputs:
    bucketName: output<string>
    queueUrl: output<string>

Prevention

  • Always pass { parent: this } to child resources created inside a ComponentResource.
  • Call registerOutputs() with the component's outputs for proper dependency tracking.
  • Expose child resources as public properties for external access.
  • Use the ComponentResourceOptions to forward provider and dependsOn to the component.
  • Wrap async initialization in an async factory pattern when the component needs async setup.

DodaTech applies similar defensive patterns across Doda Browser, DodaZIP, and Durga Antivirus Pro infrastructure for production reliability.

Common Mistakes with component resource

  1. Using head and tail instead of pattern matching, causing runtime errors on empty lists
  2. Forgetting that lazy evaluation defers computation until the value is forced, causing space leaks with unevaluated thunks
  3. Using return to exit a function early instead of wrapping a pure value in the monad

These mistakes appear frequently in real-world PULUMI code. DodaTech's contributors have identified these patterns through analysis of open-source projects and production systems.

Practice Exercise

Write a pure function that safely divides two integers using Maybe, then test it with edge cases like division by zero and negative numbers.

This exercise reinforces the concepts covered in this guide. Try implementing it before checking online solutions.

FAQ

**Q: What is the most common cause of this pulumi error?**

A: Configuration drift between environments and version mismatches between the client and server are the top causes. Always verify both before deeper troubleshooting.

Q: Can this error affect production traffic?

A: Yes. Depending on whether the error occurs in the control plane or data plane, it can block all traffic or cause silent failures. Always test configuration changes in a staging environment first.

Q: How do I monitor for this error in production?

A: Set up log-based alerts for the error signature shown in the Wrong Output section. Prometheus, Grafana, and Datadog all support pattern matching on log entries.

Q: Is there a quick rollback procedure?

A: If you have the previous configuration version, revert and restart. For data-plane errors, replay affected records from the source of truth. Always version control your configuration.


This quick fix is part of the DodaTech infrastructure engineering series. Learn more at DodaTech tutorials.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro