I'm deleting a stack (due to getting things in a tangle and needing to REDO FROM START) and it seems that the stack has resources which depend on other resources and get deleted when the parent resource is deleted, and then pulumi tries to delete them, as they were created after the parents. This of course fails, and then I need to edit the state to match reality and then I can proceed with deleting the rest of the stack.
e.g. I created a ClusterRoleBinding after the EKS cluster it was in and now pulumi is trying to delete it after deleting the cluster.
This is fine, and I can fix it. But could I have declared the RoleBinding in a way that pulumi knew that deleting the cluster would delete it or that it depends on the cluster and thus should be deleted first?
I shall have a look at that, I think I need something. When I first did this I didn't make the ClusterRole or Binding, I made the cluster and then I added in the CR and CRB to the code. Which worked ok. But now (having deleted all the resources) when I try
it tries to create them before the cluster, which obviously fails. Seems like dependOn should fix that.