This message was deleted.
# general
s
This message was deleted.
m
f
I was trying to do the same thing and sent a PR for it: https://github.com/pulumi/pulumi-awsx/pull/560
šŸ‘ 1
m
@famous-garage-15683 thank you. I think this is exactly what I'll need when it's released. I'm having a hard time figuring out how to use it though. You're right that I'm doing exactly what you're doing (would be interested in your new architecture that doesn't need this anymore).
Would you have an example of how to re-create a resource, like the
<http://aws.lb|aws.lb>.Listener
with an ARN?
oh I think I get it. The projects will reference the same aws resource, but will have different pulumi ids per project
f
yeah. I'm pretty new to Pulumi. that was the most I figured out how to do
šŸ‘ 1
m
I think it's a good solution. What is the different architecture you're using to bypass what we're trying to do?
m
That was a lot of work to create a new listener rule on an ALB / Listener created in another stack (shared-infrastructure). Am I doing something extremely wrong, or is it just this long-winded and not very clear?
Copy code
const alb = new awsx.lb.ApplicationLoadBalancer(`${appName}-lb`, {
  loadBalancer: aws.lb.LoadBalancer.get(`${appName}-lb`, defaultAlbId, {
    vpcId: vpc.vpc.id
  }),
  external: true,
  securityGroups: [defaultAlbSecurityGroupId],
  subnets: vpc.vpc.publicSubnetIds,
  vpc: vpc.vpc,
});

const appTargetGroup = new awsx.lb.ApplicationTargetGroup(`${appName}-tg`, {
  deregistrationDelay: 0,
  healthCheck: {
    path: '/api/health',
    port: '443',
    protocol: 'HTTP',
    matcher: '200',
  },
  loadBalancer: alb,
  port: 443,
  protocol: 'HTTP',
  vpc: vpc.vpc,
});

const https = new awsx.lb.ApplicationListener(`${appName}-https`, {
  listener: aws.lb.Listener.get(`${appName}-https`, defaultListenerHttpsId),
  loadBalancer: alb,
  targetGroup: appTargetGroup,
  vpc: vpc.vpc,
})

const appListenerRule = new awsx.lb.ListenerRule(`${appName}-lr`, https, {
  actions: [
    {
      targetGroupArn: appTargetGroup.targetGroup.arn.apply(v => v),
      type: 'forward',
    },
  ],
  conditions: [
    {
      hostHeader: {
        values: [`${appName}.*`],
      },
    },
  ],
  priority: 10,
});