swift-planet-53281
10/08/2021, 12:44 PMerror creating ELBv2 Listener (arn:aws:elasticloadbalancing:eu-west-1:###########:loadbalancer/net/Pulumi-LB-f7b33b7/53038cb254ec917f): TargetGroupAssociationLimit: The following target groups cannot be associated with more than one load balancer: arn:aws:elasticloadbalancing:eu-west-1:############:targetgroup/datahub-tg-8e3c646/06da054467749336
This seems to be caused by the fact that a new listener is created first (before the old one is removed), leading to a temporary invalid situation. How should I go about this?
NB: Relevant part of source code is in thread below.const lb = new aws.lb.LoadBalancer("Pulumi-LB", {
subnetMappings: [
{
allocationId: eip1.allocationId,
subnetId: subnetIds[0]
},
{
allocationId: eip2.allocationId,
subnetId: subnetIds[1]
}
],
loadBalancerType: "network",
ipAddressType: "ipv4"
})
const tg = new aws.lb.TargetGroup("datahub-tg", {
port: 80,
protocol: "TCP",
vpcId: vpc.id
})
const listener = new aws.lb.Listener("datahub-listener", {
loadBalancerArn: lb.arn,
defaultActions: [{
type: "forward",
targetGroupArn: tg.arn
}],
port: 88,
protocol: "TCP"
})