And here's what the code looks like: ```export co...
# general
w
And here's what the code looks like:
Copy code
export const loadBalancer = new aws.lb.LoadBalancer("app", {
  internal: false,
  loadBalancerType: "application",
  securityGroups: [securityGroups.allowHttps.id, securityGroups.allowHttp.id],
  subnetMappings: [
    { subnetId: vpc.publicSubnetIds, allocationId: eip.ipAddress.id }
  ]
});
c
subnetIds is an array, so you need to specify an index
Copy code
export const loadBalancer = new aws.lb.LoadBalancer("app", {
  internal: false,
  loadBalancerType: "application",
  securityGroups: [securityGroups.allowHttps.id, securityGroups.allowHttp.id],
  subnetMappings: [
    { subnetId: vpc.publicSubnetIds[0], allocationId: eip.ipAddress.id }
  ]
});
eg
w
I ended up writing this
Copy code
vpc.publicSubnetIds.then(subnetIds => {
  pulumi.all(subnetIds).apply(subnetIds => {
    const subnetMappings = subnetIds.map(id => {
      return {
        subnetId: id,
        allocationId: eip.ipAddress.publicIp
      }
    });

    new awsx.lb.ApplicationLoadBalancer("app", {
      securityGroups: [securityGroups.allowHttps.id, securityGroups.allowHttp.id],
      subnetMappings: subnetMappings
    });
  });
});
But I just learned you cannot assign elastic ips to application load balancers.
c
You need a different EIP for each Subnet too - and yeah might need a NLB instead.
Why the requirement for static IPs?
w
So I can make an A record on Cloudflare.
c
If you're using Cloudflare in front, a CNAME/ALIAS should be fine.
w
Huh, can Cloudflare do that? Going to see.
Yeah, I can make a root level CNAME.
Is there a way to move the new application load balancer out of the promise?
So that way I can export it from the file?
c
the CNAME address yes