https://pulumi.com logo
Title
d

damp-painting-47843

11/14/2022, 8:41 PM
Can I force a dependency on a replacement? I have an issue where a dependent item is being created before the item it is dependent on being replaced. I tried the dependsOn listenerOption but it doesn’t seem to work.
l

little-cartoon-10569

11/14/2022, 8:50 PM
I've never been able to figure this one.. have always had to do this manually 😞
d

damp-painting-47843

11/14/2022, 8:53 PM
Ouch.
l

little-cartoon-10569

11/14/2022, 8:54 PM
It works for a single resource, but if that resource has dependencies... ¯\_(ツ)_/¯
d

damp-painting-47843

11/14/2022, 8:54 PM
I wonder if a potential solution is to remove the paralellism? I.e. pulumi up -parallel 1 ?
l

little-cartoon-10569

11/14/2022, 8:54 PM
Try it, but I'm not optimistic...
I think it's not even trying to replace the dependent resource, iirc.
d

damp-painting-47843

11/14/2022, 8:56 PM
For me this is the case: • AWS LoadBalancer TargetGroup definition. Replace because of property change. • AWS LoadBalancer TargetGroupAttachment (creation because I just added it to the script)
l

little-cartoon-10569

11/14/2022, 8:58 PM
So in this case, I've always had to comment out the target group and attachment, to destroy them; then uncomment them to create them with the correct TG properties
d

damp-painting-47843

11/14/2022, 8:59 PM
Oof. What if I try to “get” the targetGroup after defining it using an await?
I’m going to try that and see.
The approach you had to take is making me angry 😛
Or pulumi.all maybe…
l

little-cartoon-10569

11/14/2022, 9:25 PM
I don't understand your idea? I don't think getting something from a resource will help control when it gets deleted / recreated.. 😕
d

damp-painting-47843

11/14/2022, 9:33 PM
Something must be different about the resource when it gets deleted recreated… if you could somehow test against that difference…
The problem is not knowing the property that has caused it to changed.
Although I imagine the arn will have changed…
This is hurting my brain.
l

little-cartoon-10569

11/14/2022, 9:39 PM
Unless Pulumi provides an
isDirty()
property or similar, I don't think it's feasible to tell if a resource will be deleted.
I have been treating this as a Pulumi bug / unimplemented feature, and have been working around it. I haven't been able to come up with an in-code workaround.
d

damp-painting-47843

11/14/2022, 9:55 PM
So this worked:
pulumi up -p 1
which essentially makes it non parallel, i.e. it only performs one action at a time.
l

little-cartoon-10569

11/14/2022, 9:56 PM
Niiiice.
I hope I remember that next time it happens...
d

damp-painting-47843

11/14/2022, 9:56 PM
It’s not ideal since it makes everything mucho slow
l

little-cartoon-10569

11/14/2022, 9:57 PM
I don't get how it happens though, since it should be creating all the resources before deleting others, so there should be a conflict.. but far be it from me to complain about it 🙂