fix stack reference helpers to handle nil values (#4370)
This commit is contained in:
parent
779c4144f9
commit
fe7877177c
|
@ -56,6 +56,9 @@ CHANGELOG
|
||||||
- Propagate unknowns in Go SDK during marshal operations
|
- Propagate unknowns in Go SDK during marshal operations
|
||||||
[#4369](https://github.com/pulumi/pulumi/pull/4369/files)
|
[#4369](https://github.com/pulumi/pulumi/pull/4369/files)
|
||||||
|
|
||||||
|
- Fix Go SDK stack reference helpers to handle nil values
|
||||||
|
[#4370](https://github.com/pulumi/pulumi/pull/4370)
|
||||||
|
|
||||||
## 1.14.0 (2020-04-01)
|
## 1.14.0 (2020-04-01)
|
||||||
- Fix error related to side-by-side versions of `@pulumi/pulumi`.
|
- Fix error related to side-by-side versions of `@pulumi/pulumi`.
|
||||||
[#4235](https://github.com/pulumi/pulumi/pull/4235)
|
[#4235](https://github.com/pulumi/pulumi/pull/4235)
|
||||||
|
|
|
@ -23,15 +23,19 @@ func (s *StackReference) GetOutput(name StringInput) AnyOutput {
|
||||||
|
|
||||||
// GetStringOutput returns a stack output keyed by the given name as an StringOutput
|
// GetStringOutput returns a stack output keyed by the given name as an StringOutput
|
||||||
func (s *StackReference) GetStringOutput(name StringInput) StringOutput {
|
func (s *StackReference) GetStringOutput(name StringInput) StringOutput {
|
||||||
return s.GetOutput(name).ApplyString(func(v interface{}) string {
|
return s.GetOutput(name).ApplyString(func(out interface{}) string {
|
||||||
return v.(string)
|
var res string
|
||||||
|
if out != nil {
|
||||||
|
res = out.(string)
|
||||||
|
}
|
||||||
|
return res
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetIDOutput returns a stack output keyed by the given name as an IDOutput
|
// GetIDOutput returns a stack output keyed by the given name as an IDOutput
|
||||||
func (s *StackReference) GetIDOutput(name StringInput) IDOutput {
|
func (s *StackReference) GetIDOutput(name StringInput) IDOutput {
|
||||||
return s.GetOutput(name).ApplyID(func(v interface{}) ID {
|
return s.GetStringOutput(name).ApplyID(func(out string) ID {
|
||||||
return ID(v.(string))
|
return ID(out)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue