https://pulumi.com logo
#dotnet
Title
m

mysterious-australia-14256

05/16/2020, 10:12 AM
Hi. I have creates an Azure App Service using C# and specified the following (abbreviated) args
Copy code
var webApp = new AppService(name, new AppServiceArgs
{
    ClientAffinityEnabled = false,
    HttpsOnly = true,
}
I then wanted to create a deployment slot with the same setting. I was hoping to be able to pass the webApp in and read the settings in its AppServiceArgs and use them to apply to the SlotArgs (to ensure that they ended up identical) e.g.
Copy code
var webAppSlot = new Slot(name, new SlotArgs
{
    ClientAffinityEnabled = webApp.ClientAffinityEnabled,
    HttpsOnly = webApp.HttpsOnly,
}
This seems to work for the ClientAffinityEnabled setting but for the HttpsOnly setting I get an error... Cannot implicitly convert type 'Pulumi.Output<bool?>' to 'Pulumi.Input<bool>' Why are ClientAffinityEnabled and HttpsOnly behaving differently and is there a way to be able to read the HttpsOnly setting from the webApp and apply it to the slot App? Thanks Alan
Looks like this will work
Copy code
HttpsOnly = webApp.HttpsOnly.Apply(v => v!.Value),
but I'm still not sure why ClientAffinityEnabled and HttpsOnly behave differently?
t

tall-librarian-49374

05/16/2020, 8:39 PM
That’s a very good question. The duality of nullable types in C# (value vs reference) is getting us here. Maybe we could improve this situation with an extra conversion. Do you mind creating a case in https://github.com/pulumi/pulumi ?
m

mysterious-australia-14256

05/17/2020, 4:37 PM
Thanks Mikhail here you go...