https://pulumi.com logo
#general
Title
# general
l

late-journalist-61387

10/02/2023, 7:43 AM
Unexpected Behavior: I realized settings the parent and deletedBy can be really useful when you want to destroy or update a resource, so I decided to set them, however when I do this for every resource, the pulumi try to replace it by creating new resource and deleting old one, but I just changed the parent and deletedBy, and as I did not changed any resource parameter, I expect do not replace that.
This will cause serious problem if we are in the production environment
d

dry-keyboard-94795

10/02/2023, 8:25 AM
When changing the parent, you'll also need to set up an alias so pulumi knows where to move state to
l

late-journalist-61387

10/02/2023, 8:35 AM
Thanks @dry-keyboard-94795 useful information also if I set parent for a resource, does pulumi skip delete of child resource when deleted parent? or I have to explicitly set deletedWith?
there is no information about this in the parent option docs
d

dry-keyboard-94795

10/02/2023, 8:44 AM
alias
is a ResourceOptions config. Guide on usage here: https://www.pulumi.com/blog/cumundi-guest-post/
You'd need
deletedWith
to skip the delete
l

late-journalist-61387

10/02/2023, 8:47 AM
Sorry, I did not understood, if I set the
parent
in the child resource option, does pulumi skip deleting child when deleted parent?
d

dry-keyboard-94795

10/02/2023, 8:47 AM
nope, you also need to set
deletedWith
l

late-journalist-61387

10/02/2023, 8:47 AM
I see
thank you
I can confirm that this is not working I have a secret code that the parent resource option is set to a postgress Role, however it has not been deleted in real. ( as you can see these secret already exist https://gist.github.com/atazangene/e332f0244dd87fd79f3da138f76a1a06
is it a bug?
d

dry-keyboard-94795

10/02/2023, 9:21 AM
possibly, those should have deleted
l

late-journalist-61387

10/02/2023, 9:22 AM
😭😭
d

dry-keyboard-94795

10/02/2023, 9:22 AM
If you do a pulumi refresh, do they show up in the stack again?
l

late-journalist-61387

10/02/2023, 9:22 AM
no
d

dry-keyboard-94795

10/02/2023, 9:27 AM
Does the
role
have
deletedWith=instance
or something like that?
deletedWith
may have inherited in this case due to
parent=role
.
l

late-journalist-61387

10/02/2023, 9:29 AM
yes, the role has
deletedWith=instance
I have deleted the parent: role and it has been deleted successfully
d

dry-keyboard-94795

10/02/2023, 9:39 AM
nice. I'm surprised
deletedWith
gets inherited this way
l

late-journalist-61387

10/02/2023, 9:40 AM
I am surprised too 😄
but I think it would be better to show two version of deleted status in console like (deleted / deleted by parent )
something like that
d

dry-keyboard-94795

10/02/2023, 9:44 AM
feature was implemented here, worth commenting on it with your unexpected behaviour: https://github.com/pulumi/pulumi/issues/12158 Though Frassle has already mentioned this limitation
imo, it's a breaking change, and one that won't show up until someone does deletes; not all too common except with ephemeral stacks (like yours) or if you're doing cleanup. cc @helpful-vegetable-35581
l

late-journalist-61387

10/02/2023, 9:46 AM
Yes, I see, thank you for explanation
2 Views