New to pulumi, but wanted to ask a general questio...
# general
s
New to pulumi, but wanted to ask a general question about editing resource configuration. For instance, I have an ALB target group on which I changed the port for health checks. This target group is used by an HTTPS listener. When I execute
pulumi preview
, I see the following
Copy code
@ Previewing update........................
 -- aws:lb:TargetGroup dev-api-tg delete original 
 +- aws:lb:TargetGroup dev-api-tg replace [diff: ~healthCheck,port]
 ++ aws:lb:TargetGroup dev-api-tg create replacement [diff: ~healthCheck,port]
The issue with this is that running
pulumi up
will complain that there is an existing listener that's using this target group, and therefore, the listener can't be deleted. I'm not sure about how pulumi implements this behind the scenes, but shouldn't this target group edit be an atomic operation? i.e., fail if delete + create doesn't fully succeed. In that case, if we had atomicity, the existing listener wouldn't know about this change until it's fully deployed.
l
When replacing, Pulumi creates the replacement resources before deleting the originals. Most of the time, this mitigates the need for atomicity. If there's an existing listener using the target group, that shouldn't mean the listener can't be deleted. Do you mean, there's an existing listener using the target group, so the target group can't be deleted? Generally these sorts of problems happen when there's a dependency that Pulumi doesn't know about. I wouldn't have thought that would be the case in this instance, but we'd need to see your code to be sure. If there is an unknown dependency, the dependsOn opt can be used to explicity add the dependency so that Pulumi can figure out the correct order to delete things in. Another possibility is that the default behaviour of creating before deleting is causing problems. This can happen when a non-primary-key is causing a uniqueness conflict. For example, setting up two identical security group rules isn't allow, so "swapping" two rules won't even work. If this is the case for you, there's the deleteBeforeReplace opt that you can use.