https://pulumi.com logo
Title
q

quaint-air-36266

05/05/2021, 2:26 AM
Hey guys - getting an error when trying to delete a specific resource with the Pulumi cli. Trying to run
pulumi destroy --target urn:pulumi:dev::database::aws:rds/cluster:Cluster::aurora-cluster --target-dependents
but getting the following error:
error: Cannot delete parent resource 'urn:pulumi:dev::database::aws:rds/cluster:Cluster::aurora-cluster' without also deleting child 'urn:pulumi:dev::database::aws:rds/cluster:Cluster$aws:cloudwatch/metricAlarm:MetricAlarm::chumba-casino-dev-uptime-alarm'
Unsure why its failing on removing child resources when the
--target-dependents
toggle is being used.
l

little-cartoon-10569

05/05/2021, 2:27 AM
Is a child resource necessarily dependent on the parent resource? Maybe add an explicit dependsOn and see if that helps?
If there's no property in the child resource that refers back to a property of the parent resource, then maybe
--target-dependents
won't notice...
1
r

red-match-15116

05/05/2021, 2:48 AM
A child isn’t a “dependent” technically. “dependent” relationships are defined by
dependsOn
and would be destroyed by
--target-dependents
. Parent-child relationships are defined by the
parent
property and/or
componentResources
I do find it odd though, the docs for
--target
say
All resources necessary to destroy this target will also be destroyed.
I would expect that to mean that it would destroy the child.
I expect @little-cartoon-10569 is right on the money here though as to why that happens
q

quaint-air-36266

05/05/2021, 3:22 AM
Thanks @little-cartoon-10569 @red-match-15116 - for now I think easiest solution is to define each resource individually with its own
--target
flag. Thanks for the help
l

little-cartoon-10569

05/05/2021, 3:23 AM
I guess you don't have too many resources 🙂 A dependsOn added to the opts of everything that has a parent opt would be first choice! 🙂
👍 1
r

red-match-15116

05/05/2021, 3:25 AM
This issue covers what we’ve discussed: https://github.com/pulumi/pulumi/issues/5870 - feel free to upvote/comment as that helps with prioritizing