g

    great-byte-67992

    3 months ago
    Hello, I'm having trouble with aliases after setting the parent of a resource.
    const mongodbPassword = new random.RandomPassword(
      `my-password`,
      {
        length: 32,
        special: false,
      },
      {
        parent: this, // <-- previously undefined
        aliases: [
          {
            name: `my-password`,
            project: pulumi.getProject(),
            stack: pulumi.getStack(),
            parent: pulumi.rootStackResource,
          },
        ],
      }
    );
    Have I done something obviously wrong? I've also tried using a full URN for the "name" in the alias object but I get the same result. Pulumi thinks it needs to delete and create the resource because of the parent change. I'm having this problem for all resources in my stack including a helm Chart resource.
    l

    little-cartoon-10569

    3 months ago
    Have you tried omitting all those default values? There is a difference between using a value that is the same as the default, and omitting the property to fall back to the default.
    Also, you could try setting the alias first, without setting parent. Then update the code to add the parent opt. I don't know if it's needed for this, but it is needed for protected, so .. worth a shot?
    g

    great-byte-67992

    3 months ago
    Have you tried omitting all those default values?
    Yeah my first attempt was just setting the
    parent: pulumi.rootStackResource
    field. The pulumi preview showed a delete+create as well.
    Also, you could try setting the alias first, without setting parent. Then update the code to add the parent opt. I don't know if it's needed for this, but it is needed for protected, so .. worth a shot?
    I'll give it a shot now
    No dice, but it's okay. I'll just nuke and recreate.