Unexpected Behavior: I realized settings the paren...
# general
l
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
When changing the parent, you'll also need to set up an alias so pulumi knows where to move state to
l
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
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
Sorry, I did not understood, if I set the
parent
in the child resource option, does pulumi skip deleting child when deleted parent?
d
nope, you also need to set
deletedWith
l
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
possibly, those should have deleted
l
😭😭
d
If you do a pulumi refresh, do they show up in the stack again?
l
no
d
Does the
role
have
deletedWith=instance
or something like that?
deletedWith
may have inherited in this case due to
parent=role
.
l
yes, the role has
deletedWith=instance
I have deleted the parent: role and it has been deleted successfully
d
nice. I'm surprised
deletedWith
gets inherited this way
l
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
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
Yes, I see, thank you for explanation