зеркало из https://github.com/Azure/vdc.git
147 строки
6.3 KiB
JSON
147 строки
6.3 KiB
JSON
{
|
|
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
|
|
"contentVersion": "2.0.0.0",
|
|
"parameters": {
|
|
"vNetName": {
|
|
"type": "string",
|
|
"metadata": {
|
|
"description": "Required. The Virtual Network (vNet) Name."
|
|
}
|
|
},
|
|
"vNetAddressPrefixes": {
|
|
"type": "array",
|
|
"metadata": {
|
|
"description": "Required. An Array of 1 or more IP Address Prefixes for the Virtual Network."
|
|
}
|
|
},
|
|
"subnets": {
|
|
"type": "array",
|
|
"minLength": 1,
|
|
"metadata": {
|
|
"description": "Required. An Array of subnets to deploy to the Virual Network."
|
|
}
|
|
},
|
|
"dnsServers": {
|
|
"type": "array",
|
|
"defaultValue": [],
|
|
"metadata": {
|
|
"description": "Optional. DNS Servers associated to the Virtual Network."
|
|
}
|
|
},
|
|
"enableDdosProtection": {
|
|
"type": "bool",
|
|
"defaultValue": true,
|
|
"metadata": {
|
|
"description": "Optional. Indicates if DDoS protection is enabled for all the protected resources in the Virtual Network. A 'true' value requires a DDoS Protection Plan to be specified."
|
|
}
|
|
},
|
|
"enableVmProtection": {
|
|
"type": "bool",
|
|
"defaultValue": true,
|
|
"metadata": {
|
|
"description": "Optional. Indicates if VM protection is enabled for all the subnets in the Virtual Network."
|
|
}
|
|
}
|
|
},
|
|
"variables": {
|
|
"subnetNamesToOutput": {
|
|
"copy": [
|
|
{
|
|
"name": "subnetNamesOutput",
|
|
"count": "[length(parameters('subnets'))]",
|
|
"input": "[parameters('subnets')[copyIndex('subnetNamesOutput')].name]"
|
|
}
|
|
]
|
|
},
|
|
"subnetIdsToOutput": {
|
|
"copy": [
|
|
{
|
|
"name": "subnetIdsOutput",
|
|
"count": "[length(parameters('subnets'))]",
|
|
"input": "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('vNetName'), parameters('subnets')[copyIndex('subnetIdsOutput')].name)]"
|
|
}
|
|
]
|
|
},
|
|
"ddosProtectionPlanName": "[concat(parameters('vNetName'), '-ddos')]",
|
|
"dnsServers": {
|
|
"dnsServers": "[parameters('dnsServers')]"
|
|
}
|
|
},
|
|
"resources": [
|
|
{
|
|
"type": "Microsoft.Network/ddosProtectionPlans",
|
|
"apiVersion": "2018-02-01",
|
|
"name": "[variables('ddosProtectionPlanName')]",
|
|
"condition": "[parameters('enableDdosProtection')]",
|
|
"location": "[resourceGroup().location]",
|
|
"properties": {}
|
|
},
|
|
{
|
|
"type": "Microsoft.Network/virtualNetworks",
|
|
"apiVersion": "2019-02-01",
|
|
"name": "[parameters('vNetName')]",
|
|
"location": "[resourceGroup().location]",
|
|
"properties": {
|
|
"addressSpace": {
|
|
"addressPrefixes": "[parameters('vNetAddressPrefixes')]"
|
|
},
|
|
"ddosProtectionPlan": "[if(equals(parameters('enableDdosProtection'), bool('false')), json('null'), json(concat('{\"id\":\"', resourceId('Microsoft.Network/ddosProtectionPlans', variables('ddosProtectionPlanName')),'\"}')))]",
|
|
"dhcpOptions": "[if(empty(parameters('dnsServers')), json('null'), variables('dnsServers'))]",
|
|
"enableDdosProtection": "[parameters('enableDdosProtection')]",
|
|
"enableVmProtection": "[parameters('enableVmProtection')]",
|
|
"copy": [
|
|
{
|
|
"name": "subnets",
|
|
"count": "[length(parameters('subnets'))]",
|
|
"input": {
|
|
"name": "[parameters('subnets')[copyIndex('subnets')].name]",
|
|
"properties": {
|
|
"addressPrefix": "[parameters('subnets')[copyIndex('subnets')].addressPrefix]",
|
|
"networkSecurityGroup": "[if(empty(parameters('subnets')[copyIndex('subnets')].networkSecurityGroupName), json('null'), json(concat('{\"id\": \"', resourceId('Microsoft.Network/networkSecurityGroups', parameters('subnets')[copyIndex('subnets')].networkSecurityGroupName), '\"}')))]",
|
|
"routeTable": "[if(empty(parameters('subnets')[copyIndex('subnets')].routeTableName), json('null'), json(concat('{\"id\": \"', resourceId('Microsoft.Network/routeTables', parameters('subnets')[copyIndex('subnets')].routeTableName), '\"}')))]",
|
|
"serviceEndpoints": "[if(empty(parameters('subnets')[copyIndex('subnets')].serviceEndpoints), json('null'), parameters('subnets')[copyIndex('subnets')].serviceEndpoints)]"
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"outputs": {
|
|
"vNetResourceGroup": {
|
|
"type": "string",
|
|
"value": "[resourceGroup().name]",
|
|
"metadata": {
|
|
"description": "The name of the Resource Group the Virtual Network was created in."
|
|
}
|
|
},
|
|
"vNetResourceId": {
|
|
"type": "string",
|
|
"value": "[resourceId('Microsoft.Network/virtualNetworks', parameters('vNetName'))]",
|
|
"metadata": {
|
|
"description": "The Resource id of the Virtual Network deployed."
|
|
}
|
|
},
|
|
"vNetName": {
|
|
"type": "string",
|
|
"value": "[parameters('vNetName')]",
|
|
"metadata": {
|
|
"description": "The name of the Virtual Network deployed."
|
|
}
|
|
},
|
|
"subnetNames": {
|
|
"type": "array",
|
|
"value": "[variables('subnetNamesToOutput').subnetNamesOutput]",
|
|
"metadata": {
|
|
"description": "The Names of the Subnets deployed to the Virtual Network."
|
|
}
|
|
},
|
|
"subnetIds": {
|
|
"type": "array",
|
|
"value": "[variables('subnetIdsToOutput').subnetIdsOutput]",
|
|
"metadata": {
|
|
"description": "The Resource Ids of the Subnets deployed to the Virtual Network."
|
|
}
|
|
}
|
|
}
|
|
} |