Can anyone explain to me why <
# aws
Can anyone explain to me why can create multiple pulumi resources
but in the end, they all have the same
and in AWS exist as a single listener?
Can you share a minimal example of this?
simply create a listener in a loop like this, I'd expect this to blow up but it went through which confused me.
Copy code
publicServicePorts.forEach((port) => {
        const targetGroup = alb.createTargetGroup(
            deregistrationDelay: 10,
            protocol: "HTTP",
            healthCheck: {
              path: args.healthCheckPath ?? DefaultHealthCheckPath,
              interval: 21,
              timeout: 20,
              unhealthyThreshold: 5,
            slowStart: 30,
            stickiness: {
              cookieDuration: 3600,
              enabled: true,
              type: "lb_cookie",

        portApplicationMappingPublic[port] = {
          listener: targetGroup.createListener(
              defaultAction: {
                type: "fixed-response",
                fixedResponse: {
                  contentType: "text/plain",
                  statusCode: "403",
                  messageBody: "403 Forbidden",
              external: false,
              name: `${lbPrefix}-public-${port}`,
              port: 443,
              protocol: "HTTPS",
              sslPolicy: args.publicAccess?.sslPolicy || "ELBSecurityPolicy-TLS13-1-2-2021-06",
Can you share a full example, stripped down to the essential bits?
The code that does this is all in that same file - see for example It is creating multiple instances of the component, but Bose instances share an underlying default listener instance in AWS via the logic there.
Thanks Luke, it starting to make sense! I wish I could just run the code in debug and go through step by step. this magic with object instances is not very obvious because in my case there were 3 items in the state but on one Listener and awsx made it look like there are multiple listeneres
I wish I could just run the code in debug and go through step by step.
Yes indeed! You technically can already - see comments on with suggestions. But we are also working on some improvements to make this more "push button" so you can directly debug a Pulumi program and automatically attach to the processes running any of the components it uses (like AWSX in this case).
This is amazing, I remember reading that issue long time ago it has gotten way easier! I am slowly working towards removing AWSX from the codebase. The magic behind finding the
which is actually a
is crazy, I feel like an Alice going down the rabbit hole. It is bizarre how the code can create 3 Listeners in the state referring to the same AWS object. I am trying to track down where is the reference to the original kept and how it is propagated to the pulumi resource in the state. So that result is: 3 different
but the same AWS
. And then looping over
is smart enough to merge all rules into a single listener without causing duplicates