sparse-intern-71089
02/22/2021, 8:45 PMlittle-cartoon-10569
02/22/2021, 8:47 PMlittle-cartoon-10569
02/22/2021, 8:48 PMoutputStr.apply(str => <http://pulumi.log.info|pulumi.log.info>(`Your message is ${str}`));
little-cartoon-10569
02/22/2021, 8:49 PMpulumi.Input<string>
. Maybe we can help arrange your code to do that?mammoth-honey-6147
02/22/2021, 8:54 PMredJoinCommand := redcluster.ClusterRegistrationToken.Command()
I'd like to put this into a string var so I can construct a script I can pass as userdata to my ec2 instance:
replacer := strings.NewReplacer("$redcommand", redJoinCommand,)
But I can't do this directly due to:
Cannot use 'redJoinCommand' (type pulumi.StringPtrOutput) as type string
little-cartoon-10569
02/22/2021, 8:55 PMlittle-cartoon-10569
02/22/2021, 8:58 PMpulumi.Input<string>
value (or whatever the Python equivalent is), so you don't need to convert from that for userData. You do need some way to do call NewReplacer on it, and that takes a string.mammoth-honey-6147
02/22/2021, 8:58 PMlittle-cartoon-10569
02/22/2021, 8:58 PMapply
that you pass to the ec2 instance.mammoth-honey-6147
02/22/2021, 8:59 PMlittle-cartoon-10569
02/22/2021, 9:00 PMnew aws.ec2.Instance("myName", {
userData: calculatedString,
...
}, {});
You do this sort of thing:
new aws.ec2.Instance("myName", {
userData: redJoinCommand.apply(redJoinCommand => calculateString(redJoinCommand)),
...
}, {});
little-cartoon-10569
02/22/2021, 9:00 PMwhite-balloon-205
little-cartoon-10569
02/22/2021, 9:05 PMmammoth-honey-6147
02/22/2021, 9:08 PMlittle-cartoon-10569
02/22/2021, 9:10 PMlittle-cartoon-10569
02/22/2021, 9:10 PMmammoth-honey-6147
02/22/2021, 9:17 PMmammoth-honey-6147
02/22/2021, 10:00 PMcommandString := redcluster.ClusterRegistrationToken.Command().ApplyT(func(command string) (string, error) {
return string(command), nil
})
Where redcluster.ClusterRegistrationToken.Command() is of type StringPtrOutput
But Pulumi panics with panic: applier must have 1 input parameter assignable from *string
little-cartoon-10569
02/22/2021, 10:01 PMstring
parameter to your handler func, instead of a *string
/ StringPtr
?little-cartoon-10569
02/22/2021, 10:01 PMmammoth-honey-6147
02/22/2021, 10:07 PMmammoth-honey-6147
02/22/2021, 10:46 PMtemp
is pulumi.StringOutput
vs what I need which is just a string
- any ideas?
temp := redcluster.ClusterRegistrationToken.Command().ApplyT(func(command *string) (string, error) {
return command, nil
})
fmt.Println(reflect.TypeOf(temp))
little-cartoon-10569
02/22/2021, 10:48 PMlittle-cartoon-10569
02/22/2021, 10:48 PMmammoth-honey-6147
02/22/2021, 10:54 PM