https://pulumi.com logo
#general
Title
# general
w

wooden-toddler-96888

09/16/2018, 6:49 PM
Okay... next quick question. When I see something like this:
Copy code
function getLoadBalancer(args, opts) {
    return pulumi.runtime.invoke("aws:elasticloadbalancing/getLoadBalancer:getLoadBalancer", {
        "name": args.name,
        "tags": args.tags,
    }, opts);
}
How do I find the code for
aws:elasticloadbalancing/getLoadBalancer:getLoadBalancer
? For quick context, this is what I'm trying to do. Since I'm launching a service of type LoadBalancer on EKS, I then want to get the ELB object and create a Route53 Alias to it. Since I need ELB name to
getLoadBalancer
, but EKS gives me the DNS Name or Hostname, I wanted to write a new function to get LoadBalancer by that name. I presume this'll also help when I get to launching an Ingress Controller. Of course in your blog post this works great because when you launch a CloudFront distribution, you get a rich object back. Also tell me if I'm going about this all wrong. I have a hello world launching from EKS. Just need to wire up the last Route53 record.
w

white-balloon-205

09/17/2018, 3:42 PM
Curious - where are you seeing that code above? That
invoke
will call into the AWS Pulumi provider which builds on top of the Terraform AWS Provider, and will ultimately call https://www.terraform.io/docs/providers/aws/d/lb.html. Unfortunately though, I believe Kubernetes + AWS don't offer any great solution to the core problem you are trying to solve. I might have expected Kubernetes to write the ARN of the load balancer back into the Service object, but it does not. And AWS does not offer a way to directly look up an LB ARN by DNS name. Moreover, I might also have expected Kubernetes to allow you to use an LB allocated outside of Kubernetes with a Service (and indeed, it seems perhaps this is an option for GCP, but not currently AWS?) so that you could create the LB with
@pulumi/aws
and get its ARN, etc.. Pending Kubernetes getting better at this - the two answer I can think of are: 1. Use the JS AWS SDK or AWS CLI from Pulumi to do
describe-load-balancers
to get ALL load balancers and then filter down manually to the one with the corresponding DNS name. 2. Pass the LB ARN in as config, and require a "two step" deployment where the Route53 resources are only created after that config is added, and do the
aws elb describe-load-balancers
manually outside of Pulumi.
👍 1
w

wooden-toddler-96888

09/17/2018, 4:42 PM
Yup. Indeed. I was planning on approach (1) you described. Thanks for validating. I wanted to be sure I wasn't way off. Honestly it's not that big a deal to me personally to shatter that glass.