Hey guys - getting an error when trying to delete ...
# aws
q
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
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
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
Copy code
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
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
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
This issue covers what we’ve discussed: https://github.com/pulumi/pulumi/issues/5870 - feel free to upvote/comment as that helps with prioritizing