https://pulumi.com logo
#aws
Title
# aws
s

swift-planet-53281

10/08/2021, 12:44 PM
I'm having a problem when updating loadbalancer data. Situation before: • 1 loadbalancer • 1 target group • 1 listener for the loadbalancer, forwarding to the target group. Problematic actions: 1. I updated something in the loadbalancer (added EIPs), such that it needed to be replaced 2. The pulumi tries to replace the listener as well 3. Then I get the following error:
Copy code
error 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.
Copy code
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"
})
6 Views