pulumi/sdk
Julien 95e3d8fe26
Avoid calling invokes with dependencies on unknown resources (#18152)
Nodejs implementation of #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:
```typescript
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const config = new pulumi.Config()
const billingAccountId = config.require("billing-account")

const billingAccount = gcp.organizations.getBillingAccountOutput({
    billingAccount: billingAccountId
})

const project = new gcp.organizations.Project("project", {
    billingAccount: billingAccount.id,
    name: "project-nodejs",
    autoCreateNetwork: false,
    deletionPolicy: "DELETE",
})

export const zones = gcp.compute.getZonesOutput({
    project: project.projectId,
    region: "us-central1"
}, {
    dependsOn: [project],
})
```
2025-01-07 09:55:27 +00:00
..
go Unflake TestRunCanceled (#18178) 2025-01-07 08:54:39 +00:00
nodejs Avoid calling invokes with dependencies on unknown resources (#18152) 2025-01-07 09:55:27 +00:00
proto/go Document provider Diff response requirements (#18032) 2024-12-16 11:10:28 +00:00
python Add a conformance test for component-hydrated resource references (#18153) 2025-01-06 13:40:53 +00:00
.version Prepare for v3.145.0 release (#18142) 2025-01-05 18:18:07 +00:00
README.md Cleanup sdk/README.md 2023-01-03 17:12:12 -05:00
go.mod auto/go: interrupt programs gracefully on context cancel (#18124) 2025-01-02 11:38:28 +00:00
go.sum auto/go: interrupt programs gracefully on context cancel (#18124) 2025-01-02 11:38:28 +00:00
version.go Enable goheader rule and add missing license headers (#15473) 2024-09-09 12:05:45 +00:00

README.md

Pulumi Language SDKs

This directory contains Pulumi SDKs for the following languages:

See the respective READMEs for information about installing and using these libraries.

The language providers work by implementing gRPC interfaces defined in the top level directory proto.