Hi all. I have a question about getting informatio...
# python
v
Hi all. I have a question about getting information on a resource using get_? but only after the resource has been created. I have an issue where outputs for a resources (that are documented) are not a part of the resource object that I have created (another issue). For example, if I create a private endpoint resource, and use get_private_endpoint, I only want that to run after the private endpoint has been created. Is that possible?
b
if you pass an output from the private endpoint to the
get_private_endpoint
it should happen correctly There’s an open issue to make this more concise: https://github.com/pulumi/pulumi/issues/2545
v
got it. So I could use <resource>.name or something. This would create a dependency on resource creation before the invoke of get_ is run?
b
Yep!
v
Thanks so much!!!
I tried it and get incorrect type:
b
Use the output method get_private_endpoint_output
v
That works. Now I want to take the output and give it to another get_ command. but I need the output manipulated.
Copy code
endpoint = get_private_endpoint_output(
        private_endpoint_name=aks_private_endpoint.name,
        resource_group_name=f"{stack_name}-datascience"
    )

    get_network_interface_output(
        network_interface_name=endpoint.network_interfaces[0]['id'].split("/")[-1],
        resource_group_name=f"{stack_name}-datascience"
    )
I get
Copy code
network_interface_name=endpoint.network_interfaces[0]['id'].split("/")[-1],
    TypeError: 'Output' object is not callable
Is this where I do an apply?
b
yep, you’ll need to id it inside an apply
v
OMG it worked!!!!
Copy code
endpoint = get_private_endpoint_output(
        private_endpoint_name=aks_private_endpoint.name,
        resource_group_name=f"{stack_name}-datascience"
    )

    nic = get_network_interface_output(
        network_interface_name=endpoint.apply(lambda e: e.network_interfaces[0]['id'].split("/")[-1]),
        resource_group_name=f"{stack_name}-datascience"
    )
Thanks!!!