This message was deleted.
# aws
s
This message was deleted.
l
Are you sure the problem is that the PrivateLink isn't finished being built? There's a bug in there, which is that you're running split on an output. Maybe fix that and see if the problem goes away?
I don't know how to do it in Python, but there's probably an equivalent to
pulumi.all()
, which resolves multiple outputs at once?
h
Yea basically if i rerun it after the link is built the code finishes successfully
l
Really? It shouldn't.
This code is dependent on two outputs, but you're only applying one of them:
Copy code
secret_string=cluster.connection_strings.apply(
            lambda x: json.dumps({"private_connection": f"{x[0].get(mongo_private_link_endpoint_service.id).split('://')[1]}"}
                                 )
            ),
You need to apply
mongo_private_link_endpoint_service.id
too.
h
yea sorry i was trying to make a simplified code snippet but kind of botched that, the real code is more like
Copy code
secret_string=Output.all(
     cluster.connection_strings,
     mongo_private_link_endpoint_service.interface_endpoint_id,
     ).apply(
             lambda x: 
             json.dumps({
                 "private_connection": f"{x[0].get(x[1]).split('://')[1]}"
                 })
         )
the issue is that the id for the private link exists before it is finished being created and the cluster connection strings also exist but a new value is populated only after the private link finishes
l
So applying the id is causing the error output? That sounds like a bug in the SDK. I can understand that making a connection to something might fail until it has finished setting up, but getting its id should simply wait until the id is available...
Yes, I've looked at the API, and it's normal. The output should simply wait until the value behind it is available. That's the point of outputs...
h
yea definitely. the id here does actually exist, it just doesnt exist inside the dictionary object that is the connection strings until the private link is created so since all those outputs technically exist it runs instead of waiting
wasnt sure if theres a way for me to get the apply to wait until the resource is finished i was looking through the source code and docs and havent been able to find anything
l
It looks like you're doing everything right. The depends_on shouldn't be necessary: the interface_endpoint_id.apply() achieves that. I would raise an issue here: https://github.com/pulumi/pulumi-mongodbatlas/issues
🙏 2
h
thank you! I appreciate the help
👍 2