pulumi/changelog
Julien d403b24f85
Avoid calling invokes with dependencies on unknown resources (#18141)
Python implementation of https://github.com/pulumi/pulumi/pull/18133

DependsOn for resources is an ordering constraint for register resource
calls. If a resource R1 depends on a resource R2, the register resource
call for R2 will happen after R1. This is ensured by awaiting the URN
for each resource dependency before calling register resource.

For invokes, this causes a problem when running under preview. During
preview, register resource immediately returns with the URN, however
this does not tell us if the resource "exists".

Instead of waiting for the dependency's URN, we wait for the ID. This
tells us that whether a physical resource exists (if the state is in
sync), and we can avoid calling the invoke when it is unknown.

The following example fails without this change:
```python
import pulumi
from pulumi_gcp import organizations, compute

config = pulumi.Config()
billing_account = config.require("billing-account")

project = organizations.Project(
    "project",
    name="project-1234-banana",
    billing_account=billing_account,
    auto_create_network=False,
    deletion_policy="DELETE",
)

zones = compute.get_zones_output(
    region="us-central1",
    project=project.project_id,
    status="UP",
    opts=pulumi.InvokeOutputOptions(depends_on=[project]),
)
pulumi.export("zones", zones)
```
2025-01-06 13:39:35 +00:00
..
pending Avoid calling invokes with dependencies on unknown resources (#18141) 2025-01-06 13:39:35 +00:00
config.yaml Make pulumi install work for policy packs (#16438) 2024-06-21 19:19:21 +00:00