I am struggling with inputs / outputs or just my g...
# typescript
q
I am struggling with inputs / outputs or just my general understanding
Copy code
let agwConfig: azure.network.ApplicationGatewayArgs = {
        name: agwName,
        resourceGroupName: resourceGroup.name,
        autoscaleConfiguration: {
                    minCapacity: appGatewayAutoScaleMinimumInstanceCount,
                    maxCapacity: appGatewayAutoScaleMaximumInstanceCount 
        }
        //... more code here
   }
If I wanted to optionally have the autoscaleConfiguration not be set to anything, how can I do that? I tried clearing it after with
Copy code
if (!useAppGateayAutoScale)
    {
        agwConfig.autoscaleConfiguration = null;
    }
but it gives me an error that the property is readonly so it can not be changed
w
I’m thinking you can set a variable before agwConfig that defines the autoscaleConfiguration object and then use that value in the agwConfig setting. E.g.
Copy code
const autoscaleConfig = (useAppGaeayAutoScale ? {minCapacity: appGatewayAutoScaleMinimumInstanceCount, maxCapacity: appgatewayAutoScaleMaximumInstanceCount} : {})

let agwConfig ... = {
   ...
autoscaleConfiguration: autoscaleConfig
}
q
close! I think this works:
Copy code
const autoscaleConfig = (useAppGatewayAutoScale ? {minCapacity: appGatewayAutoScaleMinimumInstanceCount, maxCapacity: appGatewayAutoScaleMaximumInstanceCount} : undefined)
(just the last bit changed to undefined instead of {} object)