Load Balancer Service Continuity During Instance Replacement

Hi all,

imagine a scenario on aws where there is a NLB with target groups attached to a couple of instances already deployed with terraform. Then, there is a need to replace these instances due to an AMI update. This will result in these 2 instances to be destroyed and added as well as the respective aws_lb_target_group_attachment.

Am I correct in considering that there will be a temporary service disruption as these 4 resources are destroyed and added during the apply procedure? Is there a way to avoid that? The aws_instance resources have a create_before_destroy statement, but I don’t think that makes a difference as both tg attachments are replaced simultaneously.

The solution I’m thinking about is to do a apply -target to one of the instances and tg attachments, followed later by the other one. But this is not a great solution really.