This message was deleted.
# general
s
This message was deleted.
l
Resources are dependent on their parents. If a parent goes, then the definition of the child resources is incomplete.
o
Right, but there could be a flag telling it to delete a parent with all of its children. I think that’s how terraform does it
b
I think you're looking for
pulumi destroy --target {urn} --target-dependents
? Or is your intention to alter state and not actually destroy anything?
o
Yeah, I for some reason, quite frequently end up in the situation where my pulumi state and the actual state mismatches. In this particular case I was experimenting with the “import” option and ended up in the state where Pulumi has created all the objects in its own state BUT deleted them all from the actual k8s cluster 🤷 Hence yeah, I need to just cleanup the state,
destroy
won’t work 🙂
b
does a
pulumi refresh
resolve the discrepancies between state and reality?
o
nope, because it doesn’t know how to “unfurl” the
k8s.yaml.ConfigFile
For this particular case I’ve already written a shell script to delete them all btw, I was just wondering in general what’s the reason not to support children deletion
🤔 1
b
and yeah - the `--target-dependents`doesn't delete children of a given resource "just like that". Had the same issue when trying to delete things like whole component resources - it will not delete the children of said component resource just because it has
--target-dependents
like this:
Copy code
λ pulumi destroy --target urn:pulumi:stage.infra.customer::baseline-infra::dep:components:provider$dep:components:group$dep:components:network::Net --target-dependents
Previewing destroy (stage.infra.customer):
     Type                        Name                              Plan     Info
     pulumi:pulumi:Stack         baseline-infra-stage.infra.customer
     └─ dep:components:network  Net                                        1 error

Diagnostics:
  dep:components:network (Net):
    error: Cannot delete parent resource 'urn:pulumi:stage.infra.customer::baseline-infra::dep:components:provider$dep:components:group$dep:components:network::Net' without also deleting child 'urn:pulumi:stage.infra.customer::baseline-infra::dep:components:provider$dep:components:group$twin:components:network$azure-native:network:VirtualNetwork::<vnet>-<region>'.
this is why I set up all my component resources with a
create: boolean
flag - I just flip the create to false and it will remove whatever has been created from the stack.. but this doesn't resolve Maksim's issue - there's no way to remove something from a stack, let's say if something screwed up and the stack doesn't represent reality anymore (and a refresh won't work as mentioned) and it needs to be fully re-adopted or simply no longer managed by pulumi.. i.e. a pulumi destroy won't work when you just need it removed from the state since the original resource may not exist.
1