bland-dog-47600
11/25/2024, 7:08 PMArgs
which depends on a StringInput
.
This is what I do:
scheduling := args.ProvisioningModel.ToStringOutput().ApplyT(func(model string) *compute.RegionInstanceTemplateSchedulingArgs {
if model == "SPOT" {
return &compute.RegionInstanceTemplateSchedulingArgs{
AutomaticRestart: pulumi.Bool(false),
Preemptible: pulumi.Bool(true),
ProvisioningModel: pulumi.String("SPOT"),
}
}
return nil
}).(compute.RegionInstanceTemplateSchedulingPtrInput)
Then I use in compute.NewRegionInstanceTemplate
vm.RegionInstanceTemplate, err = compute.NewRegionInstanceTemplate(ctx, name, &compute.RegionInstanceTemplateArgs{
Project: args.Project,
Region: args.Region,
MachineType: args.VmType,
Scheduling: scheduling.ToRegionInstanceTemplateSchedulingPtrOutput(),
...
But on update
I get an error
interface conversion: **compute.RegionInstanceTemplateSchedulingArgs is not internal.Input: missing method ElementType
Looks like I created a pointer to a pointer? I’m reading the module’s source code to understand typing but getting very confused.
How to do it right?cold-hydrogen-54783
11/26/2024, 3:34 AMscheduling
is already a PtrOutput as you output it from the Apply
function, so you likely don't need to call ToRegionInstanceTemplateSchedulingPtrOutput()
. Perhaps just pass in the instance variable scheduling
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