Properly propagate unknowns in go SDK marshaling operations (#4369)

This commit is contained in:
Evan Boyle 2020-04-11 22:20:03 -07:00 committed by GitHub
parent 563233d16c
commit 779c4144f9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 3 deletions

View file

@ -53,6 +53,9 @@ CHANGELOG
- Fix error when setting config without value in non-interactive mode
[#4358](https://github.com/pulumi/pulumi/pull/4358)
- Propagate unknowns in Go SDK during marshal operations
[#4369](https://github.com/pulumi/pulumi/pull/4369/files)
## 1.14.0 (2020-04-01)
- Fix error related to side-by-side versions of `@pulumi/pulumi`.
[#4235](https://github.com/pulumi/pulumi/pull/4235)

View file

@ -178,9 +178,11 @@ func (ctx *Context) Invoke(tok string, args interface{}, result interface{}, opt
resolvedArgsMap = resolvedArgs.ObjectValue()
}
keepUnknowns := ctx.DryRun()
rpcArgs, err := plugin.MarshalProperties(
resolvedArgsMap,
plugin.MarshalOptions{KeepUnknowns: false, KeepSecrets: true})
plugin.MarshalOptions{KeepUnknowns: keepUnknowns, KeepSecrets: true},
)
if err != nil {
return fmt.Errorf("marshaling arguments: %w", err)
}
@ -215,7 +217,10 @@ func (ctx *Context) Invoke(tok string, args interface{}, result interface{}, opt
}
// Otherwsie, simply unmarshal the output properties and return the result.
outProps, err := plugin.UnmarshalProperties(resp.Return, plugin.MarshalOptions{KeepSecrets: true})
outProps, err := plugin.UnmarshalProperties(
resp.Return,
plugin.MarshalOptions{KeepSecrets: true, KeepUnknowns: keepUnknowns},
)
if err != nil {
return err
}
@ -693,7 +698,10 @@ func (state *resourceState) resolve(dryrun bool, err error, inputs *resourceInpu
var outprops resource.PropertyMap
if err == nil {
outprops, err = plugin.UnmarshalProperties(result, plugin.MarshalOptions{KeepSecrets: true})
outprops, err = plugin.UnmarshalProperties(
result,
plugin.MarshalOptions{KeepSecrets: true, KeepUnknowns: dryrun},
)
}
if err != nil {
// If there was an error, we must reject everything.