def modify_vm_deployment_template_resources_array()

in deploy/asset-inventory-arm/generate_dev_template.py [0:0]


def modify_vm_deployment_template_resources_array(template):
    """
    Modify the resources array of the cloudbeat VM deployment template in-place.
    :param template: Parsed dictionary of the template
    """
    template["resources"] = [
        resource
        for resource in template["resources"]
        # Delete generated key pair since we provide our own
        if resource["name"] != "cloudbeatGenerateKeypair"
    ] + [
        {
            "type": "Microsoft.Network/publicIPAddresses",
            "name": "cloudbeatPublicIpDevOnly",
            "apiVersion": "2020-05-01",
            "location": "[resourceGroup().location]",
            "properties": {"publicIPAllocationMethod": "Dynamic"},
        },
        {
            "type": "Microsoft.Network/networkSecurityGroups",
            "name": "cloudbeatNSGDevOnly",
            "apiVersion": "2021-04-01",
            "location": "[resourceGroup().location]",
            "properties": {
                "securityRules": [
                    {
                        "name": "AllowSshAll",
                        "properties": {
                            "access": "Allow",
                            "destinationAddressPrefix": "*",
                            "destinationPortRange": "22",
                            "direction": "Inbound",
                            "priority": 100,
                            "protocol": "Tcp",
                            "sourceAddressPrefix": "*",
                            "sourcePortRange": "*",
                        },
                    },
                ],
            },
        },
    ]