better-actor-92669
11/24/2020, 5:13 PM# rrdatas=[
# dbs_instance_pulumi_objects[item].
# network_interfaces[0]['networkIp'],
# ],
But when you initiate the stack for the first time in a new project and all instances are yet to be created alongside DNS records, networkInterfaces
only contains this
networkInterfaces : [
[0]: {
subnetwork: output<string>
}
]
When some instance is finally created, it becomes
networkInterfaces
[
{
"accessConfigs": [],
"aliasIpRanges": [],
"name": "nic0",
"network": "<https://www.googleapis.com/compute/v1/projects/some-project/global/networks/vpc-network-default-b803ef2>",
"networkIp": "10.122.0.3",
"subnetwork": "<https://www.googleapis.com/compute/v1/projects/some-project/regions/europe-west1/subnetworks/vpc-subnetwork-default-bab788a>",
"subnetworkProject": "some-subnetwork"
}
]
How can I ask pulumi to wait for the value, even though the key is not present yet? Or how should I reference it properly?witty-candle-66007
11/24/2020, 7:20 PMinitiate the stack
and then when some instance is finally created
are you referring to the preview part of a pulumi up
as that first bit and the actual deployment as the second bit?
If so, pulumi preview is not able to show actual values for resource properties since it doesn’t know them yet. Once you let it deploy then it’s able to show the properties.
Regardless, if you use outputs from one resource as inputs to another resource, Pulumi will manage the dependencies.better-actor-92669
11/24/2020, 8:07 PMwitty-candle-66007
11/24/2020, 9:17 PM.apply()
to essentially tell Pulumi the answer is coming later:
https://www.pulumi.com/docs/intro/concepts/programming-model/#outputsbetter-actor-92669
11/24/2020, 9:48 PMbackend_instance_pulumi_objects[item].network_interfaces.apply(
lambda x: x[0].get('networkIp')
),
The Code snippet above worked for me in the endbackend_instance_pulumi_objects[item].network_interfaces.apply(
lambda x: x[0].get('networkIp')
),
The Code snippet above worked for me in the end