func that converts it to a string from a string pointer
hundreds-article-77945
12/17/2021, 9:19 PM
Just following up, but that’s what I went with:
Copy code
// UnwrapString converts a StringPtrOutput to a StringOutput.
//
// If the string is `nil`, an empty string will be returned.
func UnwrapString(sp pulumi.StringPtrOutput) pulumi.StringOutput {
return sp.ApplyT(func(v *string) string {
if v == nil {
return ""
}
return *v
}).(pulumi.StringOutput)
}
No matter how you like to participate in developer communities, Pulumi wants to meet you there. If you want to meet other Pulumi users to share use-cases and best practices, contribute code or documentation, see us at an event, or just tell a story about something cool you did with Pulumi, you are part of our community.