https://pulumi.com logo
#kubernetes
Title
# kubernetes
g

gray-electrician-97832

08/28/2023, 6:03 PM
Looking for ideas from the experts. I have a moderately complicated Pulumi script that works very well -- this is on AWS -- deploys S3, EKS, ACM certs, RDS, multiple k8s deployment and services, and Cloudflare records. The only problem is I have to run the process in phases -- if I try to run it straight through, there are errors relating to Output types. I understand the issue generally and have used
apply
and
Output.all
effectively in several places. But I can't figure out how to make a later step depend on a status of EKS itself, or a k8s deployment or service. I've tried things like:
Copy code
## note -- depl
something_else(opts=pulumi.ResourceOptions(depends_on=app_depl)

## or

## note -- svc
something_else(opts=pulumi.ResourceOptions(depends_on=app_svc)

## or

app_hostname = app_svc.status.load_balancer.ingress[0].hostname
...
something_else(opts=pulumi.ResourceOptions(depends_on=app_hostname)
b

billowy-army-68599

08/28/2023, 6:12 PM
You can’t depends on an output of a resource, you can only depend on the resource itself. It looks like you’re trying to set a variable to the value of a property and depend on that
t

thankful-controller-17230

09/28/2023, 3:37 PM
you need to make an
Input
of
something_else()
use an
Output
of
app_hostname
… if it’s not a direct attribute/`Output` then use
.apply()
something like:
Copy code
something_else(
    ip_addrs = [
        app_hostname.status.apply(lambda x: x.load_balancer.ingress[0].hostname),
    ],
)
the
depends_on
will be inferred by pulumi b/c of the
Output
to
Input
relationship