depends_on doesnt seem to work here - Iam creating...
# general
c
depends_on doesnt seem to work here - Iam creating a deploymenet object (pulumi_kubernetes.apps.v1) from like: deployment = Deployment(app_name,..... Setting up a loadbalancer object like : nlb = Service(app_name,.... When i try to get the exteneded configuration of lb like : lb = aws.lb.get_load_balancer(name=nlb["load_balancer"]["ingress"][0]["hostname"].apply(lambda hn: hn.split('-')[0]), opts=pulumi.ResourceOptions(depends_on=[nlb])) It returns the entire list of loadbalancers as if the name= filter were none. My guess is there is a timing issue where the get_load_balancer is getting executed sooner before the nlb gets created. If timing is the issue, How do i make sure aws.lb.get_load_balancer gets called after the nlb creation ? [ depends_on seems to have no effect. else Looking for more Debugging techniques coz theres not much in the error message except : Exception: invocation of awslb/getLoadBalancergetLoadBalancer returned an error: invoking awslb/getLoadBalancergetLoadBalancer: Search returned 50 results, please revise so only one is returned
a
The way your code is written, the name filter is indeed being read too early. You would need to restructure the code so that aws.lb.get_load_balancer() is being called inside the lambda from nlb["load_balancer"]["ingress"][0]["hostname"].apply(). Within the apply lambda, the hostname becomes a string. Outside the apply, it will always be a pulumi.Output<string>, which cannot be passed into the "name=" filter. If you're familiar with asynchronous calls using Python Futures or Javascript Promises, the pulumi.Output model follows very similar design patterns.
👍 1
c
tried lambda yesterday, just that i have lot more code going inside the lambda, wish depends_on worked as expected.