From 6564acb570bb73f0bb2e7d0e3028f56811005c05 Mon Sep 17 00:00:00 2001 From: evanboyle Date: Mon, 10 Feb 2020 14:01:05 -0800 Subject: [PATCH] checkpoint --- sdk/go/pulumi/context.go | 16 +++++++++------- sdk/go/pulumi/types.go | 23 +++++++++++++++++------ 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/sdk/go/pulumi/context.go b/sdk/go/pulumi/context.go index 0ab8f2ca9..43dd232a5 100644 --- a/sdk/go/pulumi/context.go +++ b/sdk/go/pulumi/context.go @@ -313,13 +313,14 @@ func (ctx *Context) ReadResource( logging.V(9).Infof("ReadResource(%s, %s): Goroutine spawned, RPC call being made", t, name) resp, err := ctx.monitor.ReadResource(ctx.ctx, &pulumirpc.ReadResourceRequest{ - Type: t, - Name: name, - Parent: inputs.parent, - Properties: inputs.rpcProps, - Provider: inputs.provider, - Id: string(idToRead), - Aliases: inputs.aliases, + Type: t, + Name: name, + Parent: inputs.parent, + Properties: inputs.rpcProps, + Provider: inputs.provider, + Id: string(idToRead), + Aliases: inputs.aliases, + AcceptSecrets: true, }) if err != nil { logging.V(9).Infof("ReadResource(%s, %s): error: %v", t, name, err) @@ -443,6 +444,7 @@ func (ctx *Context) RegisterResource( CustomTimeouts: inputs.customTimeouts, IgnoreChanges: inputs.ignoreChanges, Aliases: inputs.aliases, + AcceptSecrets: true, }) if err != nil { logging.V(9).Infof("RegisterResource(%s, %s): error: %v", t, name, err) diff --git a/sdk/go/pulumi/types.go b/sdk/go/pulumi/types.go index 2c8f80d12..d873652ff 100644 --- a/sdk/go/pulumi/types.go +++ b/sdk/go/pulumi/types.go @@ -399,6 +399,17 @@ func (o *OutputState) ApplyTWithContext(ctx context.Context, applier interface{} return result } +func SecretT(input interface{}) Output { + return SecretTWithContext(context.Background(), input) +} + +func SecretTWithContext(ctx context.Context, input interface{}) Output { + o := ToOutputWithContext(ctx, input) + // not sure if this is totally right, the input value may resolve and clobber the secret state + o.getState().secret = true + return o +} + // All returns an ArrayOutput that will resolve when all of the provided inputs will resolve. Each element of the // array will contain the resolved value of the corresponding output. The output will be rejected if any of the inputs // is rejected. @@ -795,11 +806,11 @@ func (o IDOutput) ToStringPtrOutputWithContext(ctx context.Context) StringPtrOut } func (o IDOutput) awaitID(ctx context.Context) (ID, bool, bool, error) { - id, known, secret, err := o.await(ctx) + id, known, _, err := o.await(ctx) if !known || err != nil { - return "", known, secret, err + return "", known, false, err } - return ID(convert(id, stringType).(string)), true, secret, nil + return ID(convert(id, stringType).(string)), true, false, nil } func (in URN) ToStringPtrOutput() StringPtrOutput { @@ -819,11 +830,11 @@ func (o URNOutput) ToStringPtrOutputWithContext(ctx context.Context) StringPtrOu } func (o URNOutput) awaitURN(ctx context.Context) (URN, bool, bool, error) { - id, known, secret, err := o.await(ctx) + id, known, _, err := o.await(ctx) if !known || err != nil { - return "", known, secret, err + return "", known, false, err } - return URN(convert(id, stringType).(string)), true, secret, nil + return URN(convert(id, stringType).(string)), true, false, nil } func convert(v interface{}, to reflect.Type) interface{} {