I'm hoping someone can confirm the apparent soluti...
# azure
l
I'm hoping someone can confirm the apparent solution to a syntax error that I'm encountering both in the Pulumi docs for an Azure SignalR service resource: https://www.pulumi.com/registry/packages/azure-native/api-docs/signalrservice/signalr/#signalr_createorupdate ... and in the code that
pulumi import
generates for an existing Azure SignalR resource. The specific property in question is the
NetworkACLs.PublicNetwork.Allow
property. To keep it short, the docs contain this code for that property:
Copy code
NetworkACLs = new AzureNative.SignalRService.Inputs.SignalRNetworkACLsArgs
        {
            DefaultAction = "Deny",
            PrivateEndpoints = new[]
            {
                new AzureNative.SignalRService.Inputs.PrivateEndpointACLArgs
                {
                    Allow = new[]
                    {
                        "ServerConnection",
                    },
                    Name = "mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e",
                },
            },
            PublicNetwork = new AzureNative.SignalRService.Inputs.NetworkACLArgs
            {
                Allow = new[]
                {
                    "ClientConnection",
                },
            },
        },
and the
pulumi import
generates this:
Copy code
NetworkACLs = new AzureNative.SignalRService.Inputs.SignalRNetworkACLsArgs
        {
            DefaultAction = "Deny",
            PublicNetwork = new AzureNative.SignalRService.Inputs.NetworkACLArgs
            {
                Allow = new[]
                {
                    "ServerConnection",
                    "ClientConnection",
                    "RESTAPI",
                    "Trace",
                },
            },
        },
In both cases, the
Allow
property is set based on an array of strings. That results in a syntax error:
Copy code
Cannot implicitly convert type 'string[]' to 'Pulumi.InputList<Pulumi.Union<string, Pulumi.AzureNative.SignalRService.SignalRRequestType>>'
The correct syntax seems like it should be:
Copy code
NetworkACLs = new SignalRNetworkACLsArgs
            {
                DefaultAction = "Deny",
                PublicNetwork = new NetworkACLArgs
                {
                    Allow = new InputList<Union<string, SignalRRequestType>>() { "ServerConnection", "ClientConnection", "RESTAPI", "Trace" },
                },
            },
I'm hoping that: a) Someone can confirm that the syntax that successfully compiles is a valid if not intended syntax for setting the
Allow
property; b) Someone can explain why the docs and the
pulumi import
code both contain code that has errors. Thanks.