Revert "Propagate inputs to outputs during preview. (#3245)" (#3324)

This reverts commit 80504bf0bc.
This commit is contained in:
Pat Gavlin 2019-10-10 10:33:05 -07:00 committed by GitHub
parent 5e1c4d31c6
commit 834e583c95
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
30 changed files with 151 additions and 751 deletions

View file

@ -3,6 +3,9 @@ CHANGELOG
## HEAD (Unreleased)
- Revert "propagate resource inputs to resource state during preview". These changes had a critical issue that needs
further investigation.
## 1.3.0 (2019-10-09)
- Propagate resource inputs to resource state during preview, including first-class unknown values. This allows the

View file

@ -4563,69 +4563,3 @@ func updateSpecificTargets(t *testing.T, targets []string) {
p.Run(t, old)
}
func TestPreviewInputPropagation(t *testing.T) {
loaders := []*deploytest.ProviderLoader{
deploytest.NewProviderLoader("pkgA", semver.MustParse("1.0.0"), func() (plugin.Provider, error) {
return &deploytest.Provider{
CreateF: func(urn resource.URN,
news resource.PropertyMap, timeout float64) (resource.ID, resource.PropertyMap, resource.Status, error) {
return "created-id", news, resource.StatusOK, nil
},
}, nil
}),
}
preview := true
program := deploytest.NewLanguageRuntime(func(_ plugin.RunInfo, monitor *deploytest.ResourceMonitor) error {
computed := interface{}(resource.Computed{Element: resource.NewStringProperty("")})
if !preview {
computed = "alpha"
}
ins := resource.NewPropertyMapFromMap(map[string]interface{}{
"foo": "bar",
"baz": map[string]interface{}{
"a": 42,
"b": computed,
},
"qux": []interface{}{
computed,
24,
},
"zed": computed,
})
_, _, state, err := monitor.RegisterResource("pkgA:m:typA", "resA", true, deploytest.ResourceOptions{
Inputs: ins,
})
assert.NoError(t, err)
assert.True(t, state.DeepEquals(ins))
return nil
})
host := deploytest.NewPluginHost(nil, nil, program, loaders...)
p := &TestPlan{
Options: UpdateOptions{host: host},
}
project := p.GetProject()
// Run a preview. The inputs should be propagated to the outputs during the create.
preview = true
_, res := TestOp(Update).Run(project, p.GetTarget(nil), p.Options, preview, p.BackendClient, nil)
assert.Nil(t, res)
// Run an update.
preview = false
snap, res := TestOp(Update).Run(project, p.GetTarget(nil), p.Options, preview, p.BackendClient, nil)
assert.Nil(t, res)
// Run another preview. The inputs should be propagated to the outputs during the update.
preview = true
_, res = TestOp(Update).Run(project, p.GetTarget(snap), p.Options, preview, p.BackendClient, nil)
assert.Nil(t, res)
}

View file

@ -29,19 +29,18 @@ type ResourceMonitor struct {
}
type ResourceOptions struct {
Parent resource.URN
Protect bool
Dependencies []resource.URN
Provider string
Inputs resource.PropertyMap
PropertyDeps map[resource.PropertyKey][]resource.URN
DeleteBeforeReplace *bool
Version string
IgnoreChanges []string
Aliases []resource.URN
ImportID resource.ID
CustomTimeouts *resource.CustomTimeouts
SupportsPartialValues *bool
Parent resource.URN
Protect bool
Dependencies []resource.URN
Provider string
Inputs resource.PropertyMap
PropertyDeps map[resource.PropertyKey][]resource.URN
DeleteBeforeReplace *bool
Version string
IgnoreChanges []string
Aliases []resource.URN
ImportID resource.ID
CustomTimeouts *resource.CustomTimeouts
}
func (rm *ResourceMonitor) RegisterResource(t tokens.Type, name string, custom bool,
@ -95,10 +94,6 @@ func (rm *ResourceMonitor) RegisterResource(t tokens.Type, name string, custom b
if opts.DeleteBeforeReplace != nil {
deleteBeforeReplace = *opts.DeleteBeforeReplace
}
supportsPartialValues := true
if opts.SupportsPartialValues != nil {
supportsPartialValues = *opts.SupportsPartialValues
}
requestInput := &pulumirpc.RegisterResourceRequest{
Type: string(t),
Name: name,
@ -116,7 +111,6 @@ func (rm *ResourceMonitor) RegisterResource(t tokens.Type, name string, custom b
Aliases: aliasStrings,
ImportId: string(opts.ImportID),
CustomTimeouts: &timeouts,
SupportsPartialValues: supportsPartialValues,
}
// submit request

View file

@ -88,7 +88,9 @@ type RegisterResourceEvent interface {
// RegisterResult is the state of the resource after it has been registered.
type RegisterResult struct {
State *resource.State // the resource state.
State *resource.State // the resource state.
Stable bool // if true, the resource state is stable and may be trusted.
Stables []resource.PropertyKey // an optional list of specific resource properties that are stable.
}
// RegisterResourceOutputsEvent is an event that asks the engine to complete the provisioning of a resource.

View file

@ -810,26 +810,19 @@ func (rm *resmon) RegisterResource(ctx context.Context,
return nil, rpcerror.New(codes.Unavailable, "resource monitor shut down while waiting on step's done channel")
}
// Filter out partially-known values if the requestor does not support them.
state, outputs := result.State, result.State.Outputs
if !req.GetSupportsPartialValues() {
logging.V(5).Infof("stripping unknowns from RegisterResource response for urn %v", state.URN)
filtered := resource.PropertyMap{}
for k, v := range outputs {
if !v.ContainsUnknowns() {
filtered[k] = v
}
}
outputs = filtered
state := result.State
stable := result.Stable
var stables []string
for _, sta := range result.Stables {
stables = append(stables, string(sta))
}
logging.V(5).Infof(
"ResourceMonitor.RegisterResource operation finished: t=%v, urn=%v, #outs=%v",
state.Type, state.URN, len(outputs))
"ResourceMonitor.RegisterResource operation finished: t=%v, urn=%v, stable=%v, #stables=%v #outs=%v",
state.Type, state.URN, stable, len(stables), len(state.Outputs))
// Finally, unpack the response into properties that we can return to the language runtime. This mostly includes
// an ID, URN, and defaults and output properties that will all be blitted back onto the runtime object.
obj, err := plugin.MarshalProperties(outputs, plugin.MarshalOptions{
obj, err := plugin.MarshalProperties(state.Outputs, plugin.MarshalOptions{
Label: label,
KeepUnknowns: true,
KeepSecrets: req.GetAcceptSecrets(),
@ -838,9 +831,11 @@ func (rm *resmon) RegisterResource(ctx context.Context,
return nil, err
}
return &pulumirpc.RegisterResourceResponse{
Urn: string(state.URN),
Id: string(state.ID),
Object: obj,
Urn: string(state.URN),
Id: string(state.ID),
Object: obj,
Stable: stable,
Stables: stables,
}, nil
}

View file

@ -98,7 +98,7 @@ func (s *SameStep) Apply(preview bool) (resource.Status, StepCompleteFunc, error
// Retain the ID, and outputs:
s.new.ID = s.old.ID
s.new.Outputs = s.old.Outputs
complete := func() { s.reg.Done(&RegisterResult{State: s.new}) }
complete := func() { s.reg.Done(&RegisterResult{State: s.new, Stable: true}) }
return resource.StatusOK, complete, nil
}
@ -208,8 +208,6 @@ func (s *CreateStep) Apply(preview bool) (resource.Status, StepCompleteFunc, err
s.new.ID = id
s.new.Outputs = outs
}
} else {
s.new.Outputs = s.new.Inputs
}
// Mark the old resource as pending deletion if necessary.
@ -435,12 +433,10 @@ func (s *UpdateStep) Apply(preview bool) (resource.Status, StepCompleteFunc, err
// Now copy any output state back in case the update triggered cascading updates to other properties.
s.new.Outputs = outs
}
} else {
s.new.Outputs = s.new.Inputs
}
// Finally, mark this operation as complete.
complete := func() { s.reg.Done(&RegisterResult{State: s.new}) }
complete := func() { s.reg.Done(&RegisterResult{State: s.new, Stables: s.stables}) }
if resourceError == nil {
return resourceStatus, complete, nil
}

View file

@ -131,20 +131,6 @@ class OutputImpl<T> implements OutputInstance<T> {
promise: Promise<T>,
isKnown: Promise<boolean>,
isSecret: Promise<boolean>) {
isKnown = isKnown.then(known => {
if (!known) {
// If we were explicitly not-known, then we do not have to examine the value of the output at all.
// This is also desirable as it means if the value of the output is 'rejected' it doesn't affect the
// known/not-known promise for us.
return false;
}
// Otherwise, we are only known if the resolved value of the output contains no distinguished unknown
// values and if the value's promise is not rejected.
return promise.then(v => !containsUnknowns(v), () => false);
});
this.isKnown = isKnown;
this.isSecret = isSecret;
@ -189,11 +175,7 @@ This function may throw in a future version of @pulumi/pulumi.`;
return message;
};
// runWithUnknowns requests that `func` is run even if `isKnown` resolves to `false`. This is used to allow
// callers to process fully- or partially-unknown values and return a known result. the output proxy takes
// advantage of this to allow proxied property accesses to return known values even if other properties of
// the containing object are unknown.
this.apply = <U>(func: (t: T) => Input<U>, runWithUnknowns?: boolean) => {
this.apply = <U>(func: (t: T) => Input<U>) => {
let innerDetailsResolve: (val: {isKnown: boolean, isSecret: boolean}) => void;
const innerDetails = new Promise<any>(resolve => {
innerDetailsResolve = resolve;
@ -202,15 +184,7 @@ This function may throw in a future version of @pulumi/pulumi.`;
// The known state of the output we're returning depends on if we're known as well, and
// if a potential lifted inner Output is known. If we get an inner Output, and it is
// not known itself, then the result we return should not be known.
//
// Note that the result is only known if the inner result is also known. We will allow the
// outer result to be unknown if the caller has explicitly requested that the callback run
// even with unknown values. This allows a callback to process an unknown value and return
// a known value. This is necessary for the proxy to return known values for properties in
// objects that contain unknowns.
const resultIsKnown = Promise.all([isKnown, innerDetails]).then(([k1, k2]) => {
return (k1 || runWithUnknowns) && k2.isKnown;
});
const resultIsKnown = Promise.all([isKnown, innerDetails]).then(([k1, k2]) => k1 && k2.isKnown);
const resultIsSecret = Promise.all([isSecret, innerDetails]).then(([k1, k2]) => k1 || k2.isSecret);
return new Output<U>(resources, promise.then(async v => {
@ -220,7 +194,7 @@ This function may throw in a future version of @pulumi/pulumi.`;
// give us an actual value for this Output.
const applyDuringPreview = await isKnown;
if (!applyDuringPreview && !runWithUnknowns) {
if (!applyDuringPreview) {
// We didn't actually run the function, our new Output is definitely
// **not** known.
innerDetailsResolve({
@ -328,19 +302,13 @@ To manipulate the value of this Output, use '.apply' instead.`);
// Else for *any other* property lookup, succeed the lookup and return a lifted
// `apply` on the underlying `Output`.
return (<any>obj.apply)((ob: any) => {
return obj.apply(ob => {
if (ob === undefined || ob === null) {
return undefined;
}
else if (isUnknown(ob)) {
// If the value of this output is unknown, the result of the access should also be unknown.
// This is conceptually consistent, and also prevents us from returning a "known undefined"
// value from the `ob[prop]` expression below.
return unknown;
}
return ob[prop];
}, /*runWithUnknowns:*/ true);
});
},
});
}
@ -385,18 +353,14 @@ export function output<T>(val: Input<T | undefined>): Output<Unwrap<T | undefine
// Outputs and we want to preserve them as is when flattening.
return createSimpleOutput(val);
}
else if (isUnknown(val)) {
// Turn unknowns into unknown outputs.
return <any>new Output(new Set(), Promise.resolve(<any>val), /*isKnown*/ Promise.resolve(false), /*isSecret*/ Promise.resolve(false));
}
else if (val instanceof Promise) {
// For a promise, we can just treat the same as an output that points to that resource. So
// we just create an Output around the Promise, and immediately apply the unwrap function on
// it to transform the value it points at.
return <any>(<any>new Output(new Set(), val, /*isKnown*/ Promise.resolve(true), /*isSecret*/ Promise.resolve(false))).apply(output, true);
return <any>new Output(new Set(), val, /*isKnown*/ Promise.resolve(true), /*isSecret*/ Promise.resolve(false)).apply(output);
}
else if (Output.isInstance(val)) {
return <any>(<any>val).apply(output, /*runWithUnknowns:*/ true);
return <any>val.apply(output);
}
else if (val instanceof Array) {
return <any>all(val.map(output));
@ -496,73 +460,6 @@ function getResourcesAndDetails<T>(allOutputs: Output<Unwrap<T>>[]): [Resource[]
return [allResources, isKnown, isSecret];
}
/**
* Unknown represents a value that is unknown. These values correspond to unknown property values received from the
* Pulumi engine as part of the result of a resource registration (see runtime/rpc.ts). User code is not typically
* exposed to these values: any Output<> that contains an Unknown will itself be unknown, so any user callbacks
* passed to `apply` will not be run. Internal callers of `apply` can request that they are run even with unknown
* values; the output proxy takes advantage of this to allow proxied property accesses to return known values even
* if other properties of the containing object are unknown.
*/
class Unknown {
/**
* @internal
* A private field to help with RTTI that works in SxS scenarios.
*
* This is internal instead of being truly private, to support mixins and our serialization model.
*/
// tslint:disable-next-line:variable-name
public readonly __pulumiUnknown: boolean = true;
/**
* Returns true if the given object is an instance of Unknown. This is designed to work even when
* multiple copies of the Pulumi SDK have been loaded into the same process.
*/
public static isInstance(obj: any): obj is Unknown {
return utils.isInstance(obj, "__pulumiUnknown");
}
}
/**
* @internal
* unknown is the singleton unknown value.
*/
export const unknown = new Unknown();
/**
* isUnknown returns true if the given value is unknown.
*/
export function isUnknown(val: any): boolean {
return Unknown.isInstance(val);
}
/**
* containsUnknowns returns true if the given value is or contains unknown values.
*/
export function containsUnknowns(value: any): boolean {
return impl(value, new Set<any>());
function impl(val: any, seen: Set<any>): boolean {
if (val === null || typeof val !== "object") {
return false;
}
else if (isUnknown(val)) {
return true;
}
else if (seen.has(val)) {
return false;
}
seen.add(val);
if (val instanceof Array) {
return val.some(e => impl(e, seen));
}
else {
return Object.keys(val).some(k => impl(val[k], seen));
}
}
}
/**
* [Input] is a property input for a resource. It may be a promptly available T, a promise for one,
* or the output from a existing Resource.

View file

@ -1046,8 +1046,7 @@ proto.pulumirpc.RegisterResourceRequest.toObject = function(includeInstance, msg
aliasesList: jspb.Message.getRepeatedField(msg, 15),
importid: jspb.Message.getFieldWithDefault(msg, 16, ""),
customtimeouts: (f = msg.getCustomtimeouts()) && proto.pulumirpc.RegisterResourceRequest.CustomTimeouts.toObject(includeInstance, f),
deletebeforereplacedefined: jspb.Message.getFieldWithDefault(msg, 18, false),
supportspartialvalues: jspb.Message.getFieldWithDefault(msg, 19, false)
deletebeforereplacedefined: jspb.Message.getFieldWithDefault(msg, 18, false)
};
if (includeInstance) {
@ -1160,10 +1159,6 @@ proto.pulumirpc.RegisterResourceRequest.deserializeBinaryFromReader = function(m
var value = /** @type {boolean} */ (reader.readBool());
msg.setDeletebeforereplacedefined(value);
break;
case 19:
var value = /** @type {boolean} */ (reader.readBool());
msg.setSupportspartialvalues(value);
break;
default:
reader.skipField();
break;
@ -1318,13 +1313,6 @@ proto.pulumirpc.RegisterResourceRequest.serializeBinaryToWriter = function(messa
f
);
}
f = message.getSupportspartialvalues();
if (f) {
writer.writeBool(
19,
f
);
}
};
@ -2056,23 +2044,6 @@ proto.pulumirpc.RegisterResourceRequest.prototype.setDeletebeforereplacedefined
};
/**
* optional bool supportsPartialValues = 19;
* Note that Boolean fields may be set to 0/1 when serialized from a Java server.
* You should avoid comparisons like {@code val === true/false} in those cases.
* @return {boolean}
*/
proto.pulumirpc.RegisterResourceRequest.prototype.getSupportspartialvalues = function() {
return /** @type {boolean} */ (jspb.Message.getFieldWithDefault(this, 19, false));
};
/** @param {boolean} value */
proto.pulumirpc.RegisterResourceRequest.prototype.setSupportspartialvalues = function(value) {
jspb.Message.setProto3BooleanField(this, 19, value);
};
/**
* Generated by JsPbCodeGenerator.

View file

@ -202,7 +202,6 @@ export function registerResource(res: Resource, t: string, name: string, custom:
req.setAdditionalsecretoutputsList((<any>opts).additionalSecretOutputs || []);
req.setAliasesList(resop.aliases);
req.setImportid(resop.import || "");
req.setSupportspartialvalues(true);
const customTimeouts = new resproto.RegisterResourceRequest.CustomTimeouts();
if (opts.customTimeouts != null) {

View file

@ -14,7 +14,7 @@
import * as asset from "../asset";
import * as log from "../log";
import { containsUnknowns, Input, Inputs, isSecretOutput, Output, unknown } from "../output";
import { Input, Inputs, isSecretOutput, Output } from "../output";
import { ComponentResource, CustomResource, Resource } from "../resource";
import { debuggablePromise, errorString } from "./debuggable";
import { excessiveDebugOutput, isDryRun, monitorSupportsSecrets } from "./settings";
@ -190,7 +190,7 @@ export function resolveProperties(
else {
// We're previewing. If the engine was able to give us a reasonable value back,
// then use it. Otherwise, inform the Output that the value isn't known.
const isKnown = !containsUnknowns(value);
const isKnown = value !== undefined;
resolve(value, isKnown, isSecret);
}
}
@ -206,7 +206,7 @@ export function resolveProperties(
for (const k of Object.keys(resolvers)) {
if (!allProps.hasOwnProperty(k)) {
const resolve = resolvers[k];
resolve(isDryRun() ? unknown : undefined, !isDryRun(), false);
resolve(undefined, !isDryRun(), false);
}
}
}
@ -394,7 +394,7 @@ export function deserializeProperty(prop: any): any {
throw new Error("unexpected undefined property value during deserialization");
}
else if (prop === unknownValue) {
return isDryRun() ? unknown : undefined;
return undefined;
}
else if (prop === null || typeof prop === "boolean" || typeof prop === "number" || typeof prop === "string") {
return prop;

View file

@ -15,7 +15,7 @@
// tslint:disable
import * as assert from "assert";
import { Output, concat, interpolate, output, unknown } from "../output";
import { Output, concat, interpolate, output } from "../output";
import * as runtime from "../runtime";
import { asyncTest } from "./util";
@ -69,7 +69,7 @@ describe("output", () => {
runtime._setIsDryRun(true);
const output1 = new Output(new Set(), Promise.resolve("outer"), Promise.resolve(true), Promise.resolve(false));
const output2 = output1.apply(v => new Output(new Set(), Promise.resolve("inner"), Promise.reject(new Error("foo")), Promise.resolve(false)));
const output2 = output1.apply(v => new Output(new Set(), Promise.resolve("inner"), Promise.reject(new Error()), Promise.resolve(false)));
const isKnown = await output2.isKnown;
assert.equal(isKnown, false);
@ -304,37 +304,6 @@ describe("output", () => {
const secret = await result.isSecret;
assert.equal(secret, true);
}));
it("is unknown if the value is or contains unknowns", asyncTest(async () => {
runtime._setIsDryRun(true);
const o1 = new Output(new Set(), Promise.resolve(unknown), Promise.resolve(true), Promise.resolve(false));
const o2 = new Output(new Set(), Promise.resolve(["foo", unknown]), Promise.resolve(true), Promise.resolve(false));
const o3 = new Output(new Set(), Promise.resolve({"foo": "foo", unknown}), Promise.resolve(true), Promise.resolve(false));
assert.equal(await o1.isKnown, false);
assert.equal(await o2.isKnown, false);
assert.equal(await o3.isKnown, false);
}));
it("is unknown if the result after apply is unknown or contains unknowns", asyncTest(async () => {
runtime._setIsDryRun(true);
const o1 = new Output(new Set(), Promise.resolve("foo"), Promise.resolve(true), Promise.resolve(false));
const r1 = o1.apply(v => unknown);
const r2 = o1.apply(v => [v, unknown]);
const r3 = o1.apply(v => <any>{v, unknown});
const r4 = (<any>o1.apply(v => unknown)).apply((v: any) => v, true);
const r5 = (<any>o1.apply(v => [v, unknown])).apply((v: any) => v, true);
const r6 = (<any>o1.apply(v => <any>{v, unknown})).apply((v: any) => v, true);
assert.equal(await r1.isKnown, false);
assert.equal(await r2.isKnown, false);
assert.equal(await r3.isKnown, false);
assert.equal(await r4.isKnown, false);
assert.equal(await r5.isKnown, false);
assert.equal(await r6.isKnown, false);
}));
});
describe("concat", () => {
@ -440,39 +409,5 @@ describe("output", () => {
const output1 = output({ a: 1, b: 2 });
assert.strictEqual((<any>output1).__pulumiResource, undefined);
}));
it("lifts properties from values with nested unknowns", asyncTest(async () => {
const output1 = output({ foo: "foo", bar: unknown, baz: Promise.resolve(unknown) });
assert.equal(await output1.isKnown, false);
const result1 = output1.foo;
assert.equal(await result1.isKnown, true);
assert.equal(await result1.promise(), "foo");
const result2 = output1.bar;
assert.equal(await result2.isKnown, false);
assert.equal(await result2.promise(), unknown);
const result3 = output1.baz;
assert.equal(await result3.isKnown, false);
assert.equal(await result3.promise(), unknown);
const result4 = (<any>output1.baz).qux;
assert.equal(await result4.isKnown, false);
assert.equal(await result4.promise(), unknown);
const output2 = output([ "foo", unknown ]);
assert.equal(await output2.isKnown, false);
const result5 = output2[0];
assert.equal(await result5.isKnown, true);
assert.equal(await result5.promise(), "foo");
const result6 = output2[1];
assert.equal(await result6.isKnown, false);
assert.equal(await result6.promise(), unknown);
}));
});
});

View file

@ -38,7 +38,7 @@ func (m *SupportsFeatureRequest) Reset() { *m = SupportsFeatureRequest{}
func (m *SupportsFeatureRequest) String() string { return proto.CompactTextString(m) }
func (*SupportsFeatureRequest) ProtoMessage() {}
func (*SupportsFeatureRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_resource_8180b773797d341e, []int{0}
return fileDescriptor_resource_0e7314448ddfd7ea, []int{0}
}
func (m *SupportsFeatureRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SupportsFeatureRequest.Unmarshal(m, b)
@ -76,7 +76,7 @@ func (m *SupportsFeatureResponse) Reset() { *m = SupportsFeatureResponse
func (m *SupportsFeatureResponse) String() string { return proto.CompactTextString(m) }
func (*SupportsFeatureResponse) ProtoMessage() {}
func (*SupportsFeatureResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_resource_8180b773797d341e, []int{1}
return fileDescriptor_resource_0e7314448ddfd7ea, []int{1}
}
func (m *SupportsFeatureResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SupportsFeatureResponse.Unmarshal(m, b)
@ -125,7 +125,7 @@ func (m *ReadResourceRequest) Reset() { *m = ReadResourceRequest{} }
func (m *ReadResourceRequest) String() string { return proto.CompactTextString(m) }
func (*ReadResourceRequest) ProtoMessage() {}
func (*ReadResourceRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_resource_8180b773797d341e, []int{2}
return fileDescriptor_resource_0e7314448ddfd7ea, []int{2}
}
func (m *ReadResourceRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ReadResourceRequest.Unmarshal(m, b)
@ -235,7 +235,7 @@ func (m *ReadResourceResponse) Reset() { *m = ReadResourceResponse{} }
func (m *ReadResourceResponse) String() string { return proto.CompactTextString(m) }
func (*ReadResourceResponse) ProtoMessage() {}
func (*ReadResourceResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_resource_8180b773797d341e, []int{3}
return fileDescriptor_resource_0e7314448ddfd7ea, []int{3}
}
func (m *ReadResourceResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ReadResourceResponse.Unmarshal(m, b)
@ -289,7 +289,6 @@ type RegisterResourceRequest struct {
ImportId string `protobuf:"bytes,16,opt,name=importId" json:"importId,omitempty"`
CustomTimeouts *RegisterResourceRequest_CustomTimeouts `protobuf:"bytes,17,opt,name=customTimeouts" json:"customTimeouts,omitempty"`
DeleteBeforeReplaceDefined bool `protobuf:"varint,18,opt,name=deleteBeforeReplaceDefined" json:"deleteBeforeReplaceDefined,omitempty"`
SupportsPartialValues bool `protobuf:"varint,19,opt,name=supportsPartialValues" json:"supportsPartialValues,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@ -299,7 +298,7 @@ func (m *RegisterResourceRequest) Reset() { *m = RegisterResourceRequest
func (m *RegisterResourceRequest) String() string { return proto.CompactTextString(m) }
func (*RegisterResourceRequest) ProtoMessage() {}
func (*RegisterResourceRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_resource_8180b773797d341e, []int{4}
return fileDescriptor_resource_0e7314448ddfd7ea, []int{4}
}
func (m *RegisterResourceRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_RegisterResourceRequest.Unmarshal(m, b)
@ -445,13 +444,6 @@ func (m *RegisterResourceRequest) GetDeleteBeforeReplaceDefined() bool {
return false
}
func (m *RegisterResourceRequest) GetSupportsPartialValues() bool {
if m != nil {
return m.SupportsPartialValues
}
return false
}
// PropertyDependencies describes the resources that a particular property depends on.
type RegisterResourceRequest_PropertyDependencies struct {
Urns []string `protobuf:"bytes,1,rep,name=urns" json:"urns,omitempty"`
@ -468,7 +460,7 @@ func (m *RegisterResourceRequest_PropertyDependencies) String() string {
}
func (*RegisterResourceRequest_PropertyDependencies) ProtoMessage() {}
func (*RegisterResourceRequest_PropertyDependencies) Descriptor() ([]byte, []int) {
return fileDescriptor_resource_8180b773797d341e, []int{4, 0}
return fileDescriptor_resource_0e7314448ddfd7ea, []int{4, 0}
}
func (m *RegisterResourceRequest_PropertyDependencies) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_RegisterResourceRequest_PropertyDependencies.Unmarshal(m, b)
@ -511,7 +503,7 @@ func (m *RegisterResourceRequest_CustomTimeouts) Reset() {
func (m *RegisterResourceRequest_CustomTimeouts) String() string { return proto.CompactTextString(m) }
func (*RegisterResourceRequest_CustomTimeouts) ProtoMessage() {}
func (*RegisterResourceRequest_CustomTimeouts) Descriptor() ([]byte, []int) {
return fileDescriptor_resource_8180b773797d341e, []int{4, 1}
return fileDescriptor_resource_0e7314448ddfd7ea, []int{4, 1}
}
func (m *RegisterResourceRequest_CustomTimeouts) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_RegisterResourceRequest_CustomTimeouts.Unmarshal(m, b)
@ -569,7 +561,7 @@ func (m *RegisterResourceResponse) Reset() { *m = RegisterResourceRespon
func (m *RegisterResourceResponse) String() string { return proto.CompactTextString(m) }
func (*RegisterResourceResponse) ProtoMessage() {}
func (*RegisterResourceResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_resource_8180b773797d341e, []int{5}
return fileDescriptor_resource_0e7314448ddfd7ea, []int{5}
}
func (m *RegisterResourceResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_RegisterResourceResponse.Unmarshal(m, b)
@ -637,7 +629,7 @@ func (m *RegisterResourceOutputsRequest) Reset() { *m = RegisterResource
func (m *RegisterResourceOutputsRequest) String() string { return proto.CompactTextString(m) }
func (*RegisterResourceOutputsRequest) ProtoMessage() {}
func (*RegisterResourceOutputsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_resource_8180b773797d341e, []int{6}
return fileDescriptor_resource_0e7314448ddfd7ea, []int{6}
}
func (m *RegisterResourceOutputsRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_RegisterResourceOutputsRequest.Unmarshal(m, b)
@ -888,63 +880,61 @@ var _ResourceMonitor_serviceDesc = grpc.ServiceDesc{
Metadata: "resource.proto",
}
func init() { proto.RegisterFile("resource.proto", fileDescriptor_resource_8180b773797d341e) }
func init() { proto.RegisterFile("resource.proto", fileDescriptor_resource_0e7314448ddfd7ea) }
var fileDescriptor_resource_8180b773797d341e = []byte{
// 867 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x9c, 0x56, 0xef, 0x6e, 0x1b, 0x45,
0x10, 0xaf, 0xed, 0xd6, 0x71, 0x26, 0xa9, 0x13, 0x36, 0x21, 0xb9, 0x1e, 0x28, 0x94, 0x83, 0x0f,
0x85, 0x0f, 0x0e, 0x0d, 0x48, 0x2d, 0x08, 0x81, 0x44, 0x5b, 0xa4, 0x7e, 0xa8, 0x28, 0x17, 0x84,
0x00, 0x09, 0xa4, 0xcd, 0xdd, 0xc4, 0x3d, 0x7a, 0xbe, 0x5d, 0x76, 0xf7, 0x22, 0xf9, 0x1b, 0x6f,
0xc2, 0xab, 0xf0, 0x08, 0x3c, 0x0b, 0x4f, 0xc0, 0xfe, 0x35, 0x3e, 0xdf, 0x39, 0x31, 0x7c, 0xf2,
0xce, 0x9f, 0x9d, 0xdb, 0xf9, 0xcd, 0x6f, 0x66, 0x0c, 0x63, 0x81, 0x92, 0xd5, 0x22, 0xc3, 0x09,
0x17, 0x4c, 0x31, 0xb2, 0xcd, 0xeb, 0xb2, 0x9e, 0x15, 0x82, 0x67, 0xf1, 0x5b, 0x53, 0xc6, 0xa6,
0x25, 0x9e, 0x5a, 0xc3, 0x45, 0x7d, 0x79, 0x8a, 0x33, 0xae, 0xe6, 0xce, 0x2f, 0x7e, 0x7b, 0xd5,
0x28, 0x95, 0xa8, 0x33, 0xe5, 0xad, 0x63, 0xfd, 0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df, 0x5d, 0x3b,
0xba, 0xdc, 0x06, 0xe9, 0x2f, 0x36, 0xc8, 0xbf, 0xd3, 0x61, 0xb0, 0xd9, 0x74, 0xd0, 0x50, 0x48,
0x45, 0x2f, 0x4a, 0x0c, 0x63, 0xc6, 0x49, 0x86, 0x97, 0xee, 0x64, 0xf6, 0x88, 0xe5, 0xa5, 0x17,
0x13, 0x84, 0x93, 0xd5, 0x07, 0x7a, 0x32, 0x87, 0xd1, 0xd7, 0x7e, 0xe6, 0x43, 0xd8, 0x62, 0xbe,
0x1f, 0x6e, 0x18, 0xaf, 0xc1, 0xef, 0xec, 0xcf, 0x01, 0xec, 0x85, 0xf8, 0x2f, 0x58, 0x55, 0x28,
0x26, 0xc8, 0x4f, 0xb0, 0xb7, 0xb2, 0x82, 0xc9, 0xbb, 0x4b, 0x98, 0x77, 0x2f, 0xf2, 0x38, 0xb9,
0xce, 0xc5, 0x21, 0x9b, 0xdc, 0x22, 0x5f, 0xc2, 0xf0, 0x79, 0x75, 0xc5, 0x5e, 0xeb, 0xd4, 0x97,
0xfc, 0x9d, 0x2a, 0x44, 0xba, 0xd7, 0x61, 0x59, 0x04, 0xf8, 0x16, 0x76, 0x97, 0xf7, 0x0d, 0x39,
0x69, 0xb0, 0xa1, 0xb5, 0xfc, 0xe3, 0x77, 0xd6, 0xda, 0x17, 0x21, 0x7f, 0x86, 0xfd, 0x55, 0xa8,
0x49, 0x72, 0x33, 0xc9, 0xe2, 0xf7, 0xae, 0xf5, 0x59, 0x84, 0xff, 0xa5, 0xbd, 0xbd, 0xc2, 0x58,
0xfa, 0xe0, 0x9a, 0x08, 0xcd, 0x6a, 0xc7, 0x47, 0xad, 0x52, 0x3e, 0x33, 0xff, 0xc6, 0x92, 0x5b,
0x17, 0x43, 0xab, 0xf9, 0xf8, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x7d, 0xd8, 0xd5, 0xe1, 0xca,
0x09, 0x00, 0x00,
var fileDescriptor_resource_0e7314448ddfd7ea = []byte{
// 844 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x9c, 0x56, 0xcd, 0x72, 0xe3, 0x44,
0x10, 0x5e, 0xdb, 0xbb, 0xfe, 0x69, 0x67, 0x9d, 0x30, 0x9b, 0x8a, 0xb5, 0x82, 0x0a, 0x8b, 0xe0,
0xb0, 0x70, 0x70, 0xd8, 0x70, 0xd8, 0x85, 0xa2, 0xa0, 0x8a, 0x24, 0x54, 0xe5, 0x90, 0x02, 0x14,
0x0e, 0x40, 0x15, 0x54, 0xc9, 0x52, 0xc7, 0x11, 0x91, 0x35, 0xc3, 0x68, 0xe4, 0x2a, 0xdf, 0x78,
0x0e, 0x2e, 0xbc, 0x0a, 0xcf, 0xc4, 0x13, 0x30, 0x3f, 0x1a, 0x63, 0xfd, 0xf8, 0x07, 0x4e, 0x9e,
0xfe, 0xba, 0xa7, 0x35, 0xf3, 0xf5, 0xd7, 0x3d, 0x86, 0x11, 0xc7, 0x8c, 0xe6, 0x3c, 0xc4, 0x09,
0xe3, 0x54, 0x50, 0x32, 0x60, 0x79, 0x92, 0xcf, 0x63, 0xce, 0x42, 0xf7, 0xed, 0x19, 0xa5, 0xb3,
0x04, 0xcf, 0xb4, 0x63, 0x9a, 0xdf, 0x9d, 0xe1, 0x9c, 0x89, 0xa5, 0x89, 0x73, 0xdf, 0xa9, 0x3a,
0x33, 0xc1, 0xf3, 0x50, 0x14, 0xde, 0x91, 0xfc, 0x59, 0xc4, 0x11, 0x72, 0x63, 0x7b, 0x2f, 0xe1,
0xe4, 0x36, 0x67, 0x8c, 0x72, 0x91, 0x7d, 0x8d, 0x81, 0xc8, 0x39, 0xfa, 0xf8, 0x5b, 0x8e, 0x99,
0x20, 0x23, 0x68, 0xc7, 0x91, 0xd3, 0x7a, 0xd1, 0x7a, 0x39, 0xf0, 0xe5, 0xca, 0xfb, 0x14, 0xc6,
0xb5, 0xc8, 0x8c,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, 0x50, 0x4e, 0x7e, 0x82, 0xc3, 0xca,
0x63, 0x4a, 0xde, 0x5b, 0xe3, 0xbc, 0xf9, 0x49, 0x76, 0xbd, 0x6d, 0x21, 0x86, 0x59, 0xef, 0x11,
0xf9, 0x12, 0xba, 0xd7, 0xe9, 0x82, 0x3e, 0xc8, 0xab, 0xaf, 0xc5, 0x1b, 0xc8, 0x66, 0x7a, 0xde,
0xe0, 0x59, 0x25, 0xf8, 0x0e, 0x0e, 0xd6, 0x5f, 0x0e, 0x72, 0x5a, 0x52, 0x43, 0xed, 0x19, 0x77,
0xdf, 0xdd, 0xe8, 0x5f, 0xa5, 0xfc, 0x19, 0x8e, 0xaa, 0x54, 0x13, 0x6f, 0xb7, 0xc8, 0xdc, 0xf7,
0xb7, 0xc6, 0xac, 0xd2, 0xff, 0x52, 0x7f, 0x87, 0xec, 0x80, 0xf9, 0x70, 0x4b, 0x86, 0x72, 0xb5,
0xdd, 0x93, 0x5a, 0x29, 0xaf, 0xd4, 0xff, 0x2a, 0xef, 0xd1, 0xb4, 0xab, 0x91, 0x4f, 0xfe, 0x09,
0x00, 0x00, 0xff, 0xff, 0xee, 0xb7, 0xd0, 0x4b, 0x94, 0x09, 0x00, 0x00,
}

View file

@ -97,7 +97,6 @@ message RegisterResourceRequest {
string importId = 16; // if set, this resource's state should be imported from the given ID.
CustomTimeouts customTimeouts = 17; // ability to pass a custom Timeout block.
bool deleteBeforeReplaceDefined = 18; // true if the deleteBeforeReplace property should be treated as defined even if it is false.
bool supportsPartialValues = 19; // true if the request is from an SDK that supports partially-known properties during preview.
}
// RegisterResourceResponse is returned by the engine after a resource has finished being initialized. It includes the

View file

@ -68,8 +68,6 @@ from .output import (
Output,
Input,
Inputs,
UNKNOWN,
contains_unknowns,
)
from .log import (

View file

@ -48,8 +48,8 @@ class DynamicResourceProviderServicer(ResourceProviderServicer):
raise NotImplementedError("unknown function %s" % request.token)
def Diff(self, request, context):
olds = rpc.deserialize_properties(request.olds, True)
news = rpc.deserialize_properties(request.news, True)
olds = rpc.deserialize_properties(request.olds)
news = rpc.deserialize_properties(request.news)
if news[PROVIDER_KEY] == rpc.UNKNOWN:
provider = get_provider(olds)
else:
@ -112,8 +112,8 @@ class DynamicResourceProviderServicer(ResourceProviderServicer):
return proto.CreateResponse(**fields)
def Check(self, request, context):
olds = rpc.deserialize_properties(request.olds, True)
news = rpc.deserialize_properties(request.news, True)
olds = rpc.deserialize_properties(request.olds)
news = rpc.deserialize_properties(request.news)
if news[PROVIDER_KEY] == rpc.UNKNOWN:
provider = get_provider(olds)
else:

View file

@ -31,7 +31,6 @@ from typing import (
from . import runtime
from .runtime import known_types
from .runtime import rpc
if TYPE_CHECKING:
from .resource import Resource
@ -82,19 +81,12 @@ class Output(Generic[T]):
def __init__(self, resources: Set['Resource'], future: Awaitable[T],
is_known: Awaitable[bool], is_secret: Optional[Awaitable[bool]] = None) -> None:
future = asyncio.ensure_future(future)
async def is_value_known() -> bool:
if not await is_known:
return False
return not contains_unknowns(await future)
self._resources = resources
self._future = future
self._is_known = asyncio.ensure_future(is_value_known())
self._is_known = is_known
if is_secret is not None:
self._is_secret = asyncio.ensure_future(is_secret)
self._is_secret = is_secret
else:
self._is_secret = asyncio.Future()
self._is_secret.set_result(False)
@ -113,7 +105,7 @@ class Output(Generic[T]):
return self._is_secret
# End private implementation details.
def apply(self, func: Callable[[T], Input[U]], run_with_unknowns: Optional[bool] = None) -> 'Output[U]':
def apply(self, func: Callable[[T], Input[U]]) -> 'Output[U]':
"""
Transforms the data of the output with the provided func. The result remains a
Output so that dependent resources can be properly tracked.
@ -141,7 +133,7 @@ class Output(Generic[T]):
async def is_known() -> bool:
inner = await inner_is_known
known = await self._is_known
return inner and (known or run_with_unknowns)
return inner and known
# The "is_secret" coroutine that we pass to the output we're about to create is derived from
# the disjunction of the two is_secret that we know about: our own (self._is_secret) and a future
@ -159,7 +151,7 @@ class Output(Generic[T]):
# During previews only perform the apply if the engine was able to
# give us an actual value for this Output.
apply_during_preview = await self._is_known
if not apply_during_preview and not run_with_unknowns:
if not apply_during_preview:
# We didn't actually run the function, our new Output is definitely
# **not** known and **not** secret
inner_is_known.set_result(False)
@ -211,7 +203,7 @@ class Output(Generic[T]):
:return: An Output of this Output's underlying value's property with the given name.
:rtype: Output[Any]
"""
return self.apply(lambda v: UNKNOWN if isinstance(v, Unknown) else getattr(v, item), True)
return self.apply(lambda v: getattr(v, item))
def __getitem__(self, key: Any) -> 'Output[Any]':
@ -222,7 +214,7 @@ class Output(Generic[T]):
:return: An Output of this Output's underlying value, keyed with the given key as if it were a dictionary.
:rtype: Output[Any]
"""
return self.apply(lambda v: UNKNOWN if isinstance(v, Unknown) else v[key], True)
return self.apply(lambda v: v[key])
@staticmethod
def from_input(val: Input[T]) -> 'Output[T]':
@ -236,14 +228,14 @@ class Output(Generic[T]):
"""
# Is it an output already? Recurse into the value contained within it.
if isinstance(val, Output):
return val.apply(Output.from_input, True)
return val.apply(Output.from_input)
# Is a dict or list? Recurse into the values within them.
if isinstance(val, dict):
# Since Output.all works on lists early, serialize this dictionary into a list of lists first.
# Once we have a output of the list of properties, we can use an apply to re-hydrate it back into a dict.
transformed_items = [[k, Output.from_input(v)] for k, v in val.items()]
return Output.all(*transformed_items).apply(lambda props: {k: v for k, v in props}, True)
return Output.all(*transformed_items).apply(lambda props: {k: v for k, v in props})
if isinstance(val, list):
transformed_items = [Output.from_input(v) for v in val]
@ -259,7 +251,7 @@ class Output(Generic[T]):
# as the value future for a new output.
if isawaitable(val):
promise_output = Output(set(), asyncio.ensure_future(val), is_known_fut, is_secret_fut)
return promise_output.apply(Output.from_input, True)
return promise_output.apply(Output.from_input)
# Is it a prompt value? Set up a new resolved future and use that as the value future.
value_fut = asyncio.Future()
@ -349,21 +341,3 @@ class Output(Generic[T]):
transformed_items = [Output.from_input(v) for v in args]
return Output.all(*transformed_items).apply("".join)
@known_types.unknown
class Unknown:
"""
Unknown represents a value that is unknown.
"""
def __init__(self):
pass
UNKNOWN = Unknown()
"""
UNKNOWN is the singleton unknown value.
"""
def contains_unknowns(val: Any) -> bool:
return rpc.contains_unknowns(val)

View file

@ -62,8 +62,6 @@ _remote_archive_resource_type: Optional[type] = None
_output_type: Optional[type] = None
"""The type of Output. Filled-in as the Pulumi package is initializing."""
_unknown_type: Optional[type] = None
"""The type of unknown. Filled-in as the Pulumi package is initializing."""
def asset(class_obj: type) -> type:
"""
@ -171,13 +169,6 @@ def output(class_obj: type) -> type:
return class_obj
def unknown(class_obj: type) -> type:
assert isinstance(class_obj, type), "class_obj is not a Class"
global _unknown_type
_unknown_type = class_obj
return class_obj
def new_file_asset(*args: Any) -> Any:
"""
Instantiates a new FileAsset, passing the given arguments to the constructor.
@ -222,18 +213,11 @@ def new_remote_archive(*args: Any) -> Any:
def new_output(*args: Any) -> Any:
"""
Instantiates a new Output, passing the given arguments to the constructor.
Instantiates a new StringArchive, passing the given arguments to the constructor.
"""
return _output_type(*args)
def new_unknown(*args: Any) -> Any:
"""
Instantiates a new Unknown, passing the given arguments to the constructor.
"""
return _unknown_type(*args)
def is_asset(obj: Any) -> bool:
"""
Returns true if the given type is an Asset, false otherwise.
@ -260,9 +244,3 @@ def is_output(obj: Any) -> bool:
Returns true if the given type is an Output, false otherwise.
"""
return _output_type is not None and isinstance(obj, _output_type)
def is_unknown(obj: Any) -> bool:
"""
Returns true if the given object is an Unknown, false otherwise.
"""
return _unknown_type is not None and isinstance(obj, _unknown_type)

View file

@ -22,7 +22,7 @@ DESCRIPTOR = _descriptor.FileDescriptor(
package='pulumirpc',
syntax='proto3',
serialized_options=None,
serialized_pb=_b('\n\x0eresource.proto\x12\tpulumirpc\x1a\x1bgoogle/protobuf/empty.proto\x1a\x1cgoogle/protobuf/struct.proto\x1a\x0eprovider.proto\"$\n\x16SupportsFeatureRequest\x12\n\n\x02id\x18\x01 \x01(\t\"-\n\x17SupportsFeatureResponse\x12\x12\n\nhasSupport\x18\x01 \x01(\x08\"\xfc\x01\n\x13ReadResourceRequest\x12\n\n\x02id\x18\x01 \x01(\t\x12\x0c\n\x04type\x18\x02 \x01(\t\x12\x0c\n\x04name\x18\x03 \x01(\t\x12\x0e\n\x06parent\x18\x04 \x01(\t\x12+\n\nproperties\x18\x05 \x01(\x0b\x32\x17.google.protobuf.Struct\x12\x14\n\x0c\x64\x65pendencies\x18\x06 \x03(\t\x12\x10\n\x08provider\x18\x07 \x01(\t\x12\x0f\n\x07version\x18\x08 \x01(\t\x12\x15\n\racceptSecrets\x18\t \x01(\x08\x12\x1f\n\x17\x61\x64\x64itionalSecretOutputs\x18\n \x03(\t\x12\x0f\n\x07\x61liases\x18\x0b \x03(\t\"P\n\x14ReadResourceResponse\x12\x0b\n\x03urn\x18\x01 \x01(\t\x12+\n\nproperties\x18\x02 \x01(\x0b\x32\x17.google.protobuf.Struct\"\x9f\x06\n\x17RegisterResourceRequest\x12\x0c\n\x04type\x18\x01 \x01(\t\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x0e\n\x06parent\x18\x03 \x01(\t\x12\x0e\n\x06\x63ustom\x18\x04 \x01(\x08\x12\'\n\x06object\x18\x05 \x01(\x0b\x32\x17.google.protobuf.Struct\x12\x0f\n\x07protect\x18\x06 \x01(\x08\x12\x14\n\x0c\x64\x65pendencies\x18\x07 \x03(\t\x12\x10\n\x08provider\x18\x08 \x01(\t\x12Z\n\x14propertyDependencies\x18\t \x03(\x0b\x32<.pulumirpc.RegisterResourceRequest.PropertyDependenciesEntry\x12\x1b\n\x13\x64\x65leteBeforeReplace\x18\n \x01(\x08\x12\x0f\n\x07version\x18\x0b \x01(\t\x12\x15\n\rignoreChanges\x18\x0c \x03(\t\x12\x15\n\racceptSecrets\x18\r \x01(\x08\x12\x1f\n\x17\x61\x64\x64itionalSecretOutputs\x18\x0e \x03(\t\x12\x0f\n\x07\x61liases\x18\x0f \x03(\t\x12\x10\n\x08importId\x18\x10 \x01(\t\x12I\n\x0e\x63ustomTimeouts\x18\x11 \x01(\x0b\x32\x31.pulumirpc.RegisterResourceRequest.CustomTimeouts\x12\"\n\x1a\x64\x65leteBeforeReplaceDefined\x18\x12 \x01(\x08\x12\x1d\n\x15supportsPartialValues\x18\x13 \x01(\x08\x1a$\n\x14PropertyDependencies\x12\x0c\n\x04urns\x18\x01 \x03(\t\x1a@\n\x0e\x43ustomTimeouts\x12\x0e\n\x06\x63reate\x18\x01 \x01(\t\x12\x0e\n\x06update\x18\x02 \x01(\t\x12\x0e\n\x06\x64\x65lete\x18\x03 \x01(\t\x1at\n\x19PropertyDependenciesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x46\n\x05value\x18\x02 \x01(\x0b\x32\x37.pulumirpc.RegisterResourceRequest.PropertyDependencies:\x02\x38\x01\"}\n\x18RegisterResourceResponse\x12\x0b\n\x03urn\x18\x01 \x01(\t\x12\n\n\x02id\x18\x02 \x01(\t\x12\'\n\x06object\x18\x03 \x01(\x0b\x32\x17.google.protobuf.Struct\x12\x0e\n\x06stable\x18\x04 \x01(\x08\x12\x0f\n\x07stables\x18\x05 \x03(\t\"W\n\x1eRegisterResourceOutputsRequest\x12\x0b\n\x03urn\x18\x01 \x01(\t\x12(\n\x07outputs\x18\x02 \x01(\x0b\x32\x17.google.protobuf.Struct2\xc0\x03\n\x0fResourceMonitor\x12Z\n\x0fSupportsFeature\x12!.pulumirpc.SupportsFeatureRequest\x1a\".pulumirpc.SupportsFeatureResponse\"\x00\x12?\n\x06Invoke\x12\x18.pulumirpc.InvokeRequest\x1a\x19.pulumirpc.InvokeResponse\"\x00\x12Q\n\x0cReadResource\x12\x1e.pulumirpc.ReadResourceRequest\x1a\x1f.pulumirpc.ReadResourceResponse\"\x00\x12]\n\x10RegisterResource\x12\".pulumirpc.RegisterResourceRequest\x1a#.pulumirpc.RegisterResourceResponse\"\x00\x12^\n\x17RegisterResourceOutputs\x12).pulumirpc.RegisterResourceOutputsRequest\x1a\x16.google.protobuf.Empty\"\x00\x62\x06proto3')
serialized_pb=_b('\n\x0eresource.proto\x12\tpulumirpc\x1a\x1bgoogle/protobuf/empty.proto\x1a\x1cgoogle/protobuf/struct.proto\x1a\x0eprovider.proto\"$\n\x16SupportsFeatureRequest\x12\n\n\x02id\x18\x01 \x01(\t\"-\n\x17SupportsFeatureResponse\x12\x12\n\nhasSupport\x18\x01 \x01(\x08\"\xfc\x01\n\x13ReadResourceRequest\x12\n\n\x02id\x18\x01 \x01(\t\x12\x0c\n\x04type\x18\x02 \x01(\t\x12\x0c\n\x04name\x18\x03 \x01(\t\x12\x0e\n\x06parent\x18\x04 \x01(\t\x12+\n\nproperties\x18\x05 \x01(\x0b\x32\x17.google.protobuf.Struct\x12\x14\n\x0c\x64\x65pendencies\x18\x06 \x03(\t\x12\x10\n\x08provider\x18\x07 \x01(\t\x12\x0f\n\x07version\x18\x08 \x01(\t\x12\x15\n\racceptSecrets\x18\t \x01(\x08\x12\x1f\n\x17\x61\x64\x64itionalSecretOutputs\x18\n \x03(\t\x12\x0f\n\x07\x61liases\x18\x0b \x03(\t\"P\n\x14ReadResourceResponse\x12\x0b\n\x03urn\x18\x01 \x01(\t\x12+\n\nproperties\x18\x02 \x01(\x0b\x32\x17.google.protobuf.Struct\"\x80\x06\n\x17RegisterResourceRequest\x12\x0c\n\x04type\x18\x01 \x01(\t\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x0e\n\x06parent\x18\x03 \x01(\t\x12\x0e\n\x06\x63ustom\x18\x04 \x01(\x08\x12\'\n\x06object\x18\x05 \x01(\x0b\x32\x17.google.protobuf.Struct\x12\x0f\n\x07protect\x18\x06 \x01(\x08\x12\x14\n\x0c\x64\x65pendencies\x18\x07 \x03(\t\x12\x10\n\x08provider\x18\x08 \x01(\t\x12Z\n\x14propertyDependencies\x18\t \x03(\x0b\x32<.pulumirpc.RegisterResourceRequest.PropertyDependenciesEntry\x12\x1b\n\x13\x64\x65leteBeforeReplace\x18\n \x01(\x08\x12\x0f\n\x07version\x18\x0b \x01(\t\x12\x15\n\rignoreChanges\x18\x0c \x03(\t\x12\x15\n\racceptSecrets\x18\r \x01(\x08\x12\x1f\n\x17\x61\x64\x64itionalSecretOutputs\x18\x0e \x03(\t\x12\x0f\n\x07\x61liases\x18\x0f \x03(\t\x12\x10\n\x08importId\x18\x10 \x01(\t\x12I\n\x0e\x63ustomTimeouts\x18\x11 \x01(\x0b\x32\x31.pulumirpc.RegisterResourceRequest.CustomTimeouts\x12\"\n\x1a\x64\x65leteBeforeReplaceDefined\x18\x12 \x01(\x08\x1a$\n\x14PropertyDependencies\x12\x0c\n\x04urns\x18\x01 \x03(\t\x1a@\n\x0e\x43ustomTimeouts\x12\x0e\n\x06\x63reate\x18\x01 \x01(\t\x12\x0e\n\x06update\x18\x02 \x01(\t\x12\x0e\n\x06\x64\x65lete\x18\x03 \x01(\t\x1at\n\x19PropertyDependenciesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x46\n\x05value\x18\x02 \x01(\x0b\x32\x37.pulumirpc.RegisterResourceRequest.PropertyDependencies:\x02\x38\x01\"}\n\x18RegisterResourceResponse\x12\x0b\n\x03urn\x18\x01 \x01(\t\x12\n\n\x02id\x18\x02 \x01(\t\x12\'\n\x06object\x18\x03 \x01(\x0b\x32\x17.google.protobuf.Struct\x12\x0e\n\x06stable\x18\x04 \x01(\x08\x12\x0f\n\x07stables\x18\x05 \x03(\t\"W\n\x1eRegisterResourceOutputsRequest\x12\x0b\n\x03urn\x18\x01 \x01(\t\x12(\n\x07outputs\x18\x02 \x01(\x0b\x32\x17.google.protobuf.Struct2\xc0\x03\n\x0fResourceMonitor\x12Z\n\x0fSupportsFeature\x12!.pulumirpc.SupportsFeatureRequest\x1a\".pulumirpc.SupportsFeatureResponse\"\x00\x12?\n\x06Invoke\x12\x18.pulumirpc.InvokeRequest\x1a\x19.pulumirpc.InvokeResponse\"\x00\x12Q\n\x0cReadResource\x12\x1e.pulumirpc.ReadResourceRequest\x1a\x1f.pulumirpc.ReadResourceResponse\"\x00\x12]\n\x10RegisterResource\x12\".pulumirpc.RegisterResourceRequest\x1a#.pulumirpc.RegisterResourceResponse\"\x00\x12^\n\x17RegisterResourceOutputs\x12).pulumirpc.RegisterResourceOutputsRequest\x1a\x16.google.protobuf.Empty\"\x00\x62\x06proto3')
,
dependencies=[google_dot_protobuf_dot_empty__pb2.DESCRIPTOR,google_dot_protobuf_dot_struct__pb2.DESCRIPTOR,provider__pb2.DESCRIPTOR,])
@ -256,8 +256,8 @@ _REGISTERRESOURCEREQUEST_PROPERTYDEPENDENCIES = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=1106,
serialized_end=1142,
serialized_start=1075,
serialized_end=1111,
)
_REGISTERRESOURCEREQUEST_CUSTOMTIMEOUTS = _descriptor.Descriptor(
@ -300,8 +300,8 @@ _REGISTERRESOURCEREQUEST_CUSTOMTIMEOUTS = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=1144,
serialized_end=1208,
serialized_start=1113,
serialized_end=1177,
)
_REGISTERRESOURCEREQUEST_PROPERTYDEPENDENCIESENTRY = _descriptor.Descriptor(
@ -337,8 +337,8 @@ _REGISTERRESOURCEREQUEST_PROPERTYDEPENDENCIESENTRY = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=1210,
serialized_end=1326,
serialized_start=1179,
serialized_end=1295,
)
_REGISTERRESOURCEREQUEST = _descriptor.Descriptor(
@ -474,13 +474,6 @@ _REGISTERRESOURCEREQUEST = _descriptor.Descriptor(
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='supportsPartialValues', full_name='pulumirpc.RegisterResourceRequest.supportsPartialValues', index=18,
number=19, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
],
extensions=[
],
@ -494,7 +487,7 @@ _REGISTERRESOURCEREQUEST = _descriptor.Descriptor(
oneofs=[
],
serialized_start=527,
serialized_end=1326,
serialized_end=1295,
)
@ -552,8 +545,8 @@ _REGISTERRESOURCERESPONSE = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=1328,
serialized_end=1453,
serialized_start=1297,
serialized_end=1422,
)
@ -590,8 +583,8 @@ _REGISTERRESOURCEOUTPUTSREQUEST = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=1455,
serialized_end=1542,
serialized_start=1424,
serialized_end=1511,
)
_READRESOURCEREQUEST.fields_by_name['properties'].message_type = google_dot_protobuf_dot_struct__pb2._STRUCT
@ -696,8 +689,8 @@ _RESOURCEMONITOR = _descriptor.ServiceDescriptor(
file=DESCRIPTOR,
index=0,
serialized_options=None,
serialized_start=1545,
serialized_end=1993,
serialized_start=1514,
serialized_end=1962,
methods=[
_descriptor.MethodDescriptor(
name='SupportsFeature',

View file

@ -360,7 +360,6 @@ def register_resource(res: 'Resource', ty: str, name: str, custom: bool, props:
importId=opts.import_,
customTimeouts=opts.custom_timeouts,
aliases=resolver.aliases,
supportsPartialValues=True,
)
from ..resource import create_urn

View file

@ -95,9 +95,6 @@ async def serialize_property(value: 'Input[Any]',
return props
if known_types.is_unknown(value):
return UNKNOWN
if known_types.is_custom_resource(value):
deps.append(value)
return await serialize_property(value.id, deps, input_transformer)
@ -189,7 +186,7 @@ async def serialize_property(value: 'Input[Any]',
return value
# pylint: disable=too-many-return-statements
def deserialize_properties(props_struct: struct_pb2.Struct, keep_unknowns: Optional[bool] = None) -> Any:
def deserialize_properties(props_struct: struct_pb2.Struct) -> Any:
"""
Deserializes a protobuf `struct_pb2.Struct` into a Python dictionary containing normal
Python types.
@ -231,7 +228,7 @@ def deserialize_properties(props_struct: struct_pb2.Struct, keep_unknowns: Optio
# since we can only set secret outputs on top level properties.
output = {}
for k, v in list(props_struct.items()):
value = deserialize_property(v, keep_unknowns)
value = deserialize_property(v)
# We treat values that deserialize to "None" as if they don't exist.
if value is not None:
output[k] = value
@ -253,17 +250,17 @@ def unwrap_rpc_secret(value: Any) -> Any:
return value
def deserialize_property(value: Any, keep_unknowns: Optional[bool] = None) -> Any:
def deserialize_property(value: Any) -> Any:
"""
Deserializes a single protobuf value (either `Struct` or `ListValue`) into idiomatic
Python values.
"""
if value == UNKNOWN:
return known_types.new_unknown() if settings.is_dry_run() or keep_unknowns else None
return None
# ListValues are projected to lists
if isinstance(value, struct_pb2.ListValue):
values = [deserialize_property(v, keep_unknowns) for v in value]
values = [deserialize_property(v) for v in value]
# If there are any secret values in the list, push the secretness "up" a level by returning
# an array that is marked as a secret with raw values inside.
if any(is_rpc_secret(v) for v in values):
@ -276,7 +273,7 @@ def deserialize_property(value: Any, keep_unknowns: Optional[bool] = None) -> An
# Structs are projected to dictionaries
if isinstance(value, struct_pb2.Struct):
props = deserialize_properties(value, keep_unknowns)
props = deserialize_properties(value)
# If there are any secret values in the dictionary, push the secretness "up" a level by returning
# a dictionary that is marked as a secret with raw values inside. Note: thje isinstance check here is
# important, since deserialize_properties will return either a dictionary or a concret type (in the case of
@ -368,22 +365,6 @@ def translate_output_properties(res: 'Resource', output: Any) -> Any:
return output
def contains_unknowns(val: Any) -> bool:
def impl(val: Any, stack: List[Any]) -> bool:
if known_types.is_unknown(val):
return True
if not any([x is val for x in stack]):
stack.append(val)
if isinstance(val, dict):
return any([impl(x, stack) for x in val.values()])
if isinstance(val, list):
return any([impl(x, stack) for x in val])
return False
return impl(val, [])
async def resolve_outputs(res: 'Resource',
serialized_props: struct_pb2.Struct,
outputs: struct_pb2.Struct,
@ -450,7 +431,7 @@ async def resolve_outputs(res: 'Resource',
else:
# We're previewing. If the engine was able to give us a reasonable value back,
# then use it. Otherwise, inform the Output that the value isn't known.
resolve(value, value is not None and not contains_unknowns(value), is_secret, None)
resolve(value, value is not None, is_secret, None)
# `allProps` may not have contained a value for every resolver: for example, optional outputs may not be present.
# We will resolve all of these values as `None`, and will mark the value as known if we are not running a

View file

@ -17,7 +17,7 @@ import unittest
from google.protobuf import struct_pb2
from pulumi.resource import CustomResource
from pulumi.runtime import rpc, known_types
from pulumi.output import Output, UNKNOWN
from pulumi.output import Output
from pulumi.asset import (
FileAsset,
RemoteAsset,
@ -175,9 +175,9 @@ class NextSerializationTests(unittest.TestCase):
other = FakeCustomResource("some-other-resource")
other_fut = asyncio.Future()
other_fut.set_result(UNKNOWN) # <- not known
other_fut.set_result(99)
other_known_fut = asyncio.Future()
other_known_fut.set_result(False)
other_known_fut.set_result(False) # <- not known
other_out = Output({other}, other_fut, other_known_fut)
combined = Output.all(out, other_out)
@ -250,101 +250,6 @@ class NextSerializationTests(unittest.TestCase):
self.assertIsNotNone(error)
self.assertEqual("unexpected input of type MyClass", str(error))
@async_test
async def test_distinguished_unknown_output(self):
fut = asyncio.Future()
fut.set_result(UNKNOWN)
known_fut = asyncio.Future()
known_fut.set_result(True)
out = Output({}, fut, known_fut)
self.assertFalse(await out.is_known())
fut = asyncio.Future()
fut.set_result(["foo", UNKNOWN])
out = Output({}, fut, known_fut)
self.assertFalse(await out.is_known())
fut = asyncio.Future()
fut.set_result({"foo": "foo", "bar": UNKNOWN})
out = Output({}, fut, known_fut)
self.assertFalse(await out.is_known())
@async_test
async def test_apply_unknown_output(self):
fut = asyncio.Future()
fut.set_result("foo")
known_fut = asyncio.Future()
known_fut.set_result(True)
out = Output({}, fut, known_fut)
r1 = out.apply(lambda v: UNKNOWN)
r2 = out.apply(lambda v: [v, UNKNOWN])
r3 = out.apply(lambda v: {"v": v, "unknown": UNKNOWN})
r4 = out.apply(lambda v: UNKNOWN).apply(lambda v: v, True)
r5 = out.apply(lambda v: [v, UNKNOWN]).apply(lambda v: v, True)
r6 = out.apply(lambda v: {"v": v, "unknown": UNKNOWN}).apply(lambda v: v, True)
self.assertFalse(await r1.is_known())
self.assertFalse(await r2.is_known())
self.assertFalse(await r3.is_known())
self.assertFalse(await r4.is_known())
self.assertFalse(await r5.is_known())
self.assertFalse(await r6.is_known())
@async_test
async def test_lifted_unknown(self):
fut = asyncio.Future()
fut.set_result(UNKNOWN)
out = Output.from_input({ "foo": "foo", "bar": UNKNOWN, "baz": fut})
self.assertFalse(await out.is_known())
r1 = out["foo"]
self.assertTrue(await r1.is_known())
self.assertEqual(await r1.future(), "foo")
r2 = out["bar"]
self.assertFalse(await r2.is_known())
self.assertEqual(await r2.future(), UNKNOWN)
r3 = out["baz"]
self.assertFalse(await r3.is_known())
self.assertEqual(await r3.future(), UNKNOWN)
r4 = out["baz"]["qux"]
self.assertFalse(await r4.is_known())
self.assertEqual(await r4.future(), UNKNOWN)
out = Output.from_input([ "foo", UNKNOWN ])
r5 = out[0]
self.assertTrue(await r5.is_known())
self.assertEqual(await r5.future(), "foo")
r6 = out[1]
self.assertFalse(await r6.is_known())
self.assertEqual(await r6.future(), UNKNOWN)
@async_test
async def test_output_coros(self):
# Ensure that Outputs function properly when the input value and is_known are coroutines. If the implementation
# is not careful to wrap these coroutines in Futures, they will be awaited more than once and the runtime will
# throw.
async def value():
await asyncio.sleep(0)
return 42
async def is_known():
await asyncio.sleep(0)
return True
out = Output({}, value(), is_known())
self.assertTrue(await out.is_known())
self.assertEqual(42, await out.future())
self.assertEqual(42, await out.apply(lambda v: v).future())
class DeserializationTests(unittest.TestCase):
def test_unsupported_sig(self):
struct = struct_pb2.Struct()

View file

@ -864,21 +864,3 @@ func TestCloudSecretProvider(t *testing.T) {
// Also run with local backend
t.Run("local", func(t *testing.T) { integration.ProgramTest(t, &localTestOptions) })
}
func TestPartialValuesNode(t *testing.T) {
integration.ProgramTest(t, &integration.ProgramTestOptions{
Dir: filepath.Join("partial_values", "nodejs"),
Dependencies: []string{"@pulumi/pulumi"},
AllowEmptyPreviewChanges: true,
})
}
func TestPartialValuesPython(t *testing.T) {
integration.ProgramTest(t, &integration.ProgramTestOptions{
Dir: filepath.Join("partial_values", "python"),
Dependencies: []string{
path.Join("..", "..", "sdk", "python", "env", "src"),
},
AllowEmptyPreviewChanges: true,
})
}

View file

@ -1,3 +0,0 @@
name: protect_resources
description: A program that ensures we cannot delete protected resources.
runtime: nodejs

View file

@ -1,30 +0,0 @@
// Copyright 2016-2018, Pulumi Corporation. All rights reserved.
import * as assert from "assert";
import * as pulumi from "@pulumi/pulumi";
import { Resource } from "./resource";
const unknown = <any>pulumi.output(pulumi.runtime.isDryRun() ? { __pulumiUnknown: true } : "foo");
let a = new Resource("res", {
foo: "foo",
bar: { value: "foo", unknown },
baz: [ "foo", unknown ],
});
export let o = Promise.all([
(<any>a.foo).isKnown,
(<any>a.bar.value).isKnown,
(<any>a.bar.unknown).isKnown,
(<any>a.baz[0]).isKnown,
(<any>a.baz[1]).isKnown,
]).then(([r1, r2, r3, r4, r5]) => {
assert.equal(r1, true);
assert.equal(r2, true);
assert.equal(r3, !pulumi.runtime.isDryRun());
assert.equal(r4, true);
assert.equal(r5, !pulumi.runtime.isDryRun());
console.log("ok");
return "checked";
});

View file

@ -1,13 +0,0 @@
{
"name": "steps",
"license": "Apache-2.0",
"devDependencies": {
"typescript": "^3.0.0"
},
"peerDependencies": {
"@pulumi/pulumi": "latest"
},
"dependencies": {
"@types/node": "^8.0.0"
}
}

View file

@ -1,36 +0,0 @@
// Copyright 2016-2018, Pulumi Corporation. All rights reserved.
import * as pulumi from "@pulumi/pulumi";
let currentID = 0;
export class Provider implements pulumi.dynamic.ResourceProvider {
public static readonly instance = new Provider();
public readonly create: (inputs: any) => Promise<pulumi.dynamic.CreateResult>;
constructor() {
this.create = async (inputs: any) => {
return {
id: (currentID++).toString(),
outs: inputs,
};
};
}
}
export class Resource extends pulumi.dynamic.Resource {
public readonly foo: pulumi.Output<string>;
public readonly bar: pulumi.Output<{ value: string, unknown: string }>;
public readonly baz: pulumi.Output<any[]>;
constructor(name: string, props: ResourceProps, opts?: pulumi.ResourceOptions) {
super(Provider.instance, name, props, opts);
}
}
export interface ResourceProps {
foo: pulumi.Input<string>;
bar: pulumi.Input<{ value: pulumi.Input<string>, unknown: pulumi.Input<string> }>;
baz: pulumi.Input<pulumi.Input<any>[]>;
}

View file

@ -1,4 +0,0 @@
*.pyc
/.pulumi/
/dist/
/*.egg-info

View file

@ -1,3 +0,0 @@
name: dynamic_py
description: A simple Python program that uses dynamic providers.
runtime: python

View file

@ -1,36 +0,0 @@
# Copyright 2016-2018, Pulumi Corporation. All rights reserved.
import asyncio
from pulumi import Output, export, UNKNOWN
from pulumi.dynamic import Resource, ResourceProvider, CreateResult
from pulumi.runtime import is_dry_run
class MyProvider(ResourceProvider):
def create(self, props):
return CreateResult("0", props)
class MyResource(Resource):
foo: Output
bar: Output
baz: Output
def __init__(self, name, props, opts = None):
super().__init__(MyProvider(), name, props, opts)
unknown = Output.from_input(UNKNOWN if is_dry_run() else "foo")
a = MyResource("a", {
"foo": "foo",
"bar": { "value": "foo", "unknown": unknown },
"baz": [ "foo", unknown ],
})
async def check_knowns():
assert await a.foo.is_known()
assert await a.bar["value"].is_known()
assert await a.bar["unknown"].is_known() != is_dry_run()
assert await a.baz[0].is_known()
assert await a.baz[1].is_known() != is_dry_run()
print("ok")
export("o", check_knowns())