|
- {
- "location": "{{ lb.location }}",
- "properties": {
- "backendAddressPools": [
- {% for bp in lb.backend_address_pools %}
- {
- "name": "{{ bp.name }}",
- "properties": {
- },
- },
- {% endfor %}
- ],
- "frontendIPConfigurations": [
- {% for fipc in ip_configurations %}
- {
- "name": "{{ fipc.name }}",
- "properties": {
- {% if fipc.gateway_lb_fip is defined %}
- "gatewayLoadBalancer": {
- "id": "{{ fipc.gateway_lb_fip }}"
- },
- {% endif %}
- {% if fipc.private_ip_version is defined %}
- "privateIPAddressVersion": "{{ fipc.private_ip_version }}",
- {% endif %}
- {% if fipc.private_ip_allocation_method is defined %}
- "privateIPAllocationMethod": "{{ fipc.private_ip_allocation_method }}",
- {% endif %}
- {% if fipc.private_ip_address is defined %}
- "privateIPAddress": "{{ fipc.private_ip_address }}",
- {% endif %}
- {% if fipc.public_ip_address is defined %}
- "publicIPAddress": {
- "id": "/subscriptions/{{ subscription_id }}/resourceGroups/{{ lb.resource_group }}/providers/Microsoft.Network/publicIPAddresses/{{ fipc.public_ip_address }}",
- }
- {% endif %}
- {% if fipc.subnet is defined %}
- "subnet": {
- "id": "{{ fipc.subnet }}"
- },
- {% endif %}
- },
- {% if fipc.zones is defined %}
- "zones": [
- {% for zone in fipc.zones | default([]) %}
- "{{ zone }}",
- {% endfor %}
- ]
- {% endif %}
- },
- {% endfor %}
- ],
- "probes": [
- {% for probe in lb.probes | default([]) %}
- {
- "name": "{{ probe.name }}",
- "properties": {
- "protocol": "{{ probe.protocol | default('Tcp') }}",
- "port": {{ probe.port | default(22) }},
- {% if probe.protocol is defined and probe.protocol == 'Http' %}
- "requestPath": "{{ probe.path | default('/') }}",
- {% endif %}
- "intervalInSeconds": {{ probe.interval | default(5) }},
- "numberOfProbes": {{ probe.failcount | default(3) }}
- }
- },
- {% endfor %}
- ],
- "loadBalancingRules": [
- {% for rule in lb.load_balancing_rules | default([]) %}
- {
- "name": "{{ rule.name }}",
- "properties": {
- {% if rule.probe is defined %}
- "probe": {
- "id": "/subscriptions/{{ subscription_id }}/resourceGroups/{{ lb.resource_group }}/providers/Microsoft.Network/loadBalancers/{{ lb.name }}/probes/{{ rule.probe }}"
- },
- {% endif %}
- "frontendIPConfiguration": {
- "id": "/subscriptions/{{ subscription_id }}/resourceGroups/{{ lb.resource_group }}/providers/Microsoft.Network/loadBalancers/{{ lb.name }}/frontendIPConfigurations/{{ rule.frontend_ip_configuration }}"
- },
- "backendAddressPool": {
- "id": "/subscriptions/{{ subscription_id }}/resourceGroups/{{ lb.resource_group }}/providers/Microsoft.Network/loadBalancers/{{ lb.name }}/backendAddressPools/{{ rule.backend_address_pool }}"
- },
- "frontendPort": {{ rule.frontend_port | default(0) }},
- "backendPort": {{ rule.backend_port | default(0) }},
- "enableFloatingIP": {{ rule.enable_floating_ip | default(false) }},
- "idleTimeoutInMinutes": {{ rule.idle | default(4) }},
- "protocol": "{{ rule.protocol | default('All') }}",
- "enableTcpReset": {{ rule.tcpreset | default(false) }},
- "disableOutboundSnat": {{ rule.disable_outsnat | default(false) }},
- "loadDistribution": "{{ rule.load_distribution | default('Default') }}"
- }
- },
- {% endfor %}
- ],
- "outboundRules": [
- {% for outrule in lb.outbound_rules | default([]) %}
- {
- "name": "{{ outrule.name }}",
- "properties": {
- {% if outrule.nbport is defined %}
- "allocatedOutboundPorts": {{ outrule.nbport }},
- {% endif %}
- "backendAddressPool": {
- "id": "/subscriptions/{{ subscription_id }}/resourceGroups/{{ lb.resource_group }}/providers/Microsoft.Network/loadBalancers/{{ lb.name }}/backendAddressPools/{{ outrule.backend_address_pool }}"
- },
- "enableTcpReset": {{ outrule.tcpreset | default(false) }},
- "frontendIPConfigurations": [
- {% for fipc in outrule.frontend_ip_configurations | default([]) %}
- {
- "id": "/subscriptions/{{ subscription_id }}/resourceGroups/{{ lb.resource_group }}/providers/Microsoft.Network/loadBalancers/{{ lb.name }}/frontendIPConfigurations/{{ fipc.name }}"
- },
- {% endfor %}
- ],
- "idleTimeoutInMinutes": {{ outrule.idle | default(4) }},
- "protocol": "{{ outrule.protocol | default('All') }}",
- }
- },
- {% endfor %}
- ],
- "inboundNatRules": [
- {% for inatrule in lb.inbound_nat_rules | default([]) %}
- {
- "name": "{{ inatrule.name }}",
- "properties": {
- "frontendIPConfiguration": {
- "id": "/subscriptions/{{ subscription_id }}/resourceGroups/{{ lb.resource_group }}/providers/Microsoft.Network/loadBalancers/{{ lb.name }}/frontendIPConfigurations/{{ inatrule.frontend_ip_configuration }}"
- },
- "frontendPort": {{ inatrule.frontend_port | default(0) }},
- "backendPort": {{ inatrule.backend_port | default(0) }},
- "enableFloatingIP": {{ inatrule.enable_floating_ip | default(false) }},
- "idleTimeoutInMinutes": {{ inatrule.idle | default(4) }},
- "protocol": "{{ inatrule.protocol | default('Tcp') }}",
- "enableTcpReset": {{ inatrule.tcpreset | default(false) }},
- }
- },
- {% endfor %}
- ],
- "inboundNatPools": []
- },
- "sku": {
- "name": "{{ lb.sku | default('Standard') }}",
- {% if lb.tier is defined %}
- "tier": "{{ lb.tier }}
- {% endif %}
- },
- "tags": {
- {% for key, value in (lb.tags | default({})).items() %}
- "{{ key }}": "{{ value }}",
- {% endfor %}
- }
- }
|