Hi all! I’m trying to fix a missing parent option ...
# typescript
q
Hi all! I’m trying to fix a missing parent option in a resource—it’s currently created by the constructor of a ComponentResource, but without a parent attribute. Is this the right way to do it?
Copy code
import * as awsx from `@pulumi/awsx`
import * as pulumi from `@pulumi/pulumi`

class Container extends pulumi.ComponentResource {
  constructor(name: string, args: {}, opts: pulumi.ComponentResourceOptions = {}) {
    super('example:Container', name, {}, opts);
    new awsx.ec2.Vpc('vpc', {}, {
      parent: this, // new parent
      aliases: [{
        name: 'vpc',
        parent: pulumi.rootStackResource, // old parent
      }]
    })
  }
}
I think it’s correct—at least it works as expected for an
aws.s3.Bucket
resource However,
awsx.ec2.Vpc
wants to delete and recreate itself and all children.
I suspect it’s a bug in awsx.ec2.Vpc—I’m unable to reproduce the issue with aws.s3.Bucket