elegant-zoo-39359
08/12/2022, 2:28 PMIntPtrOutput
? I've configured a helper function to take an IntPtrInput
and then want to use ApplyT
on this value to conditionally output a data structure if it is not nil, but the ApplyT
fails with a NPE if it is nil. e.g. the following will fail if size
is a IntPtrInput
that is nil (at ToIntPtrOutput()
). I could check for nil, but I don't think that would not work if size
is an IntPtrOutput
(because only its applied value would be nil).
res := size.ToIntPtrOutput().ApplyT(
func(size *int) *ec2.LaunchTemplateBlockDeviceMapping {
Is there a nice way to generically handle this? I can use pulumi.All
but that does not seem quite as elegant:
res := pulumi.All(size).ApplyT(
func(args []interface{}) []ec2.LaunchTemplateBlockDeviceMapping {
if args[0] != nil {
size := args[0].(*int)
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.
Powered by