fortinet/fortigate-autoscale-azure

0720643 - Azure VMSS - VNetRelatedResources deployment fails because of LB ip

JaydenLiang opened this issue · 0 comments

internal bug id: 0720643

content forwarded from the reporter:

[History]
Issue discovered while testing the template to validate FAZ integration for a prospect customer

[Pb description]

The template fails because it asks for the last octet for the load balancer IP
This IP is then being used to create the front end ip addresses of the LB in the respective subnets

The issue comes from the fact that the frontend ip is constructed with the concatenation of the subnet prefix and the provided last octet so this assumes that all subnets are /24

    "LoadBalancerIP": {
        "defaultValue": "10",
        "type": "String",
        "metadata": {
            "description": "The last octet of the Frontend Private IP address to be used by the Load Balancer. For example, if set to 10, the Private IP for the Load Balancer in the subnet with prefix 10.0.1.0/24 would be 10.0.1.10."
        }
    },


   "subnet2LoadBalancerIP": "[concat(substring(variables('subnet2Prefix'), 0, lastIndexOf(variables('subnet2Prefix'), '.')),'.', parameters('LoadBalancerIP'))]", <--------------Here

My template failed because I used /26 subnets

{
"status": "Failed",
"error": {
"code": "DeploymentFailed",
"message": "At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.",
"details": [
{
"code": "BadRequest",
"message": "{\r\n "error": {\r\n "code": "PrivateIPAddressNotInSubnet",\r\n "message": "Private static IP address 10.68.0.70 does not belong to the range of subnet prefix 10.68.0.128/26.",\r\n "details": []\r\n }\r\n}"
}
]
}
}

[Expected Behavior]

Never hard code ip addresses in template. Please ask them as input parameters