adorable-alligator-23779
03/22/2021, 10:21 PMlittle-cartoon-10569
03/22/2021, 10:29 PMApply
function. Often, you don't need to, as you can pass the StringPtrOutput into Pulumi resource constructors without resolving the StringPtr inside it.adorable-alligator-23779
03/22/2021, 10:32 PMlittle-cartoon-10569
03/22/2021, 10:32 PMadorable-alligator-23779
03/22/2021, 10:33 PMing, err := networkingv1.NewIngress(ctx, svcName, &networkingv1.IngressArgs{
Spec: &networkingv1.IngressSpecArgs{
Rules: &networkingv1.IngressRuleArray{
&networkingv1.IngressRuleArgs{
Host: pulumi.String("<http://test.roffe.nu|test.roffe.nu>"),
Http: &networkingv1.HTTPIngressRuleValueArgs{
Paths: &networkingv1.HTTPIngressPathArray{
&networkingv1.HTTPIngressPathArgs{
Backend: &networkingv1.IngressBackendArgs{
Service: &networkingv1.IngressServiceBackendArgs{
Name: svcName,
Port: &networkingv1.ServiceBackendPortArgs{
Number: <http://pulumi.Int|pulumi.Int>(port),
},
},
},
},
},
},
},
},
},
})
little-cartoon-10569
03/22/2021, 10:33 PMadorable-alligator-23779
03/22/2021, 10:33 PMif _, err := createIngress(ctx, svc.Name, service.Metadata.Name(), t.Port); err != nil {
return err
}
service
is a *corev1.Servicelittle-cartoon-10569
03/22/2021, 10:37 PMadorable-alligator-23779
03/22/2021, 10:38 PMlittle-cartoon-10569
03/22/2021, 10:40 PMservice.Metadata.Elem().Name()
different to what you need?adorable-alligator-23779
03/22/2021, 10:41 PMbackendName.ToStringPtrOutput().Elem()
might worklittle-cartoon-10569
03/22/2021, 10:44 PMwhite-balloon-205
03/23/2021, 12:22 AMit seems
backendName.ToStringPtrOutput().Elem()
might work
Yes - if you want to convert a StringPtrOutput
to a StringOutput
you can use .Elem()
which is the equivalent of de-referencing with *
on a plain value. Elem is just a shorthand for an Apply that de references the pointer value of the output (if/when it becomes available).
A StringOutput
can then be passed anywhere a StringInput
is expected.