sparse-intern-71089
10/14/2020, 5:08 PMelegant-island-39916
10/14/2020, 5:16 PMpulumi.Output[List]
is a list of availability zones that were used in the creation of my AWS VPC in a different stack. They are being iterated over to create a rds.ClusterInstance
for each availability zonebillowy-army-68599
elegant-island-39916
10/14/2020, 5:22 PMelegant-island-39916
10/15/2020, 8:56 AMgreen-school-95910
10/15/2020, 1:16 PMOutput#apply
is that it causes incomplete graphs in some scenarios, like during the preview phase of the first deployment of that resource. But it is not forbidden.
For your case I don't see any other option.elegant-island-39916
10/15/2020, 1:22 PMsubprocess.run(["pulumi", "stack", "select", pulumi_config.require("network-stack")])
availability_zones = json.loads(subprocess.check_output(["pulumi", "stack", "output", "availability-zones"]).decode("utf-8"))
Surely this cannot be the only way of achieving this?green-school-95910
10/15/2020, 1:23 PMelegant-island-39916
10/15/2020, 1:24 PMelegant-island-39916
10/15/2020, 1:25 PMdef create_rds_cluster_instance(az_name):
rds.ClusterInstance( ... )
network_stack = StackReference(pulumi_config.require("network-stack"))
availability_zones = network_stack.require_output("availability-zones")
availability_zones.apply(lambda zones: map(create_rds_cluster_instance, zones))
elegant-island-39916
10/15/2020, 1:38 PMdef create_rds_cluster_instance(az_name):
rds.ClusterInstance( ... )
network_stack = StackReference(pulumi_config.require("network-stack"))
availability_zones = network_stack.require_output("availability-zones")
availability_zones.apply(lambda zones: [create_rds_cluster_instance(z) for z in zones])
It's all working now. Cheers @green-school-95910!elegant-island-39916
10/15/2020, 1:41 PMmap
not evaluating all entries in the listgreen-school-95910
10/15/2020, 1:51 PMmap
evaluates lazily as a generator.