In the third snippet of the example on <https://ww...
# dotnet
In the third snippet of the example on, the C# code has an apparently-redundant
Apply(v => v.ToString())
. None of the other languages have that. Is it neccessary? If it is, why?
Yes, it is necessary. In the k8s ProviderArgs, the KubeConfig property is string. With no explicit "ToString" call in the Apply function you'll end up with a kubeConfig type of Output<object> and a compiler error. ``````
I use the following output extensions:
Copy code
public static class OutputExtensions
    public static Output<T> As<T>(this Output<object> output) => output.Apply(x => (T)x);

    public static Output<Resource> AsResource<T>(this Output<T> output) where T : Resource => output.Apply(x => (Resource)x);

    public static Output<T> WhenRun<T>(this Output<T> output, Func<T, Task> func) =>
        !Deployment.Instance.IsDryRun ? output.Apply(async value => { await func(value); return value; }) : output;
Then that line becomes:
Copy code
var kubeConfig = cluster.RequireOutput("KubeConfig").As<string>();