pulumi/tests/integration/get_created/index.ts
Pat Gavlin 5513f08669
Do not call Read in read steps with unknown IDs. (#1734)
This is consistent with the behavior prior to the introduction of Read
steps. In order to avoid a breaking change we must do this check in the
engine itself, which causes a bit of a layering violation: because IDs
are marshaled as raw strings rather than PropertyValues, the engine must
check against the marshaled form of an unknown directly (i.e.
`plugin.UnknownStringValue`).
2018-08-08 12:06:20 -07:00

31 lines
819 B
TypeScript

// Copyright 2016-2018, Pulumi Corporation. All rights reserved.
import * as pulumi from "@pulumi/pulumi";
class Provider implements pulumi.dynamic.ResourceProvider {
public static instance = new Provider();
public create: (inputs: any) => Promise<pulumi.dynamic.CreateResult>;
constructor() {
this.create = async (inputs: any) => {
return {
id: "0",
outs: undefined,
};
};
}
}
class Resource extends pulumi.dynamic.Resource {
constructor(name: string, opts?: pulumi.ResourceOptions) {
super(Provider.instance, name, {}, opts);
}
}
// Create a resource using the default dynamic provider instance.
let a = new Resource("a");
// Attempt to read the created resource.
let b = new Resource("b", { id: a.id });