pulumi/sdk/nodejs/tests/runtime
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
..
langhost Avoid calling invokes with dependencies on unknown resources (#18152) 2025-01-07 09:55:27 +00:00
testdata Fix usage of getters and setters in Lambda callback functions (#16568) 2024-07-08 09:51:12 +00:00
asyncIterableUtil.spec.ts Eliminate async promise executor. 2023-05-11 13:05:43 -04:00
closure-integration-tests.ts Use @types/node matching the ts version for integration tests (#17185) 2024-09-06 09:21:47 +00:00
findWorkspaceRoot.spec.ts Fix codepaths computation when working dir is nested relative to package.json (#15601) 2024-03-08 16:16:47 +00:00
install-package-tests.ts Vendor TypeScript and ts-node (#15622) 2024-04-10 15:26:37 +00:00
pack.ts Vendor TypeScript and ts-node (#15622) 2024-04-10 15:26:37 +00:00
props.spec.ts Replace Rome with Biome in the NodeJS SDK (#16456) 2024-06-24 11:14:56 +00:00
registrations.spec.ts Suppress grpc rejections due to the resource monitor terminating 2023-06-14 14:43:32 -07:00
rpc.spec.ts [sdk/nodejs] Maintain secretness and input dependencies of output invokes (#17479) 2024-10-05 00:40:19 +00:00
settings.spec.ts Apply autoformat 2023-04-28 18:27:10 -04:00