If it is a serialized function, something like this:
new theResource(..., {
callbackFactory: () => {
const lb2 = value.get();
return () => customFunction(lb2);
}
});
If it is part of the deployment:
// customFunction(lb2: string): T
value.apply(lb2 => customFunction(lb2)) // returns Output<T>
Even better if you change the code of the function to accepts a
Input<string>
instead of only a
string
, and apply transformations on it as needed, for example:
interface KV {
key: string;
value: string;
}
// before
function splitKeyValue(s: string): KV {
const [k, v] = s.split(':', 1);
return {key: k, value: v};
}
// after
function newSplitKeyValue(s: pulumi.Input<string>): pulumi.Output<KV> {
const pair = output(s).apply(s => s.split(':', 1));
return pair.apply(([key, value]) => ({key, value}));
}