Created
August 23, 2022 12:55
-
-
Save rtrentin73/db7eeef280f71f0cb666634f119c668d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "azurerm_resource_group" "ingress-east-us-lb-rg" { | |
name = "ingress-east-us-lb-rg" | |
location = var.region-b | |
} | |
resource "azurerm_public_ip" "ingress-east-us-lb-pip" { | |
name = "ingress-east-us-lb-pip" | |
resource_group_name = azurerm_resource_group.ingress-east-us-lb-rg.name | |
location = azurerm_resource_group.ingress-east-us-lb-rg.location | |
allocation_method = "Static" | |
sku = "Standard" | |
} | |
resource "azurerm_lb" "ingress-east-us-lb" { | |
name = "ingress-east-us-lb" | |
location = azurerm_resource_group.ingress-east-us-lb-rg.location | |
resource_group_name = azurerm_resource_group.ingress-east-us-lb-rg.name | |
sku = "Standard" | |
frontend_ip_configuration { | |
name = "PublicIPAddress" | |
public_ip_address_id = azurerm_public_ip.ingress-east-us-lb-pip.id | |
} | |
} | |
resource "azurerm_lb_probe" "ingress-east-us-lb-probe" { | |
loadbalancer_id = azurerm_lb.ingress-east-us-lb.id | |
name = "ingress-east-us-lb-probe" | |
port = "443" | |
} | |
resource "azurerm_lb_backend_address_pool_address" "azurerm_lb_backend_address_pool_address-ingress-gw-east" { | |
name = "ingress-gw-east" | |
backend_address_pool_id = azurerm_lb_backend_address_pool.ingress-east-us-lb-backend.id | |
virtual_network_id = module.ingress-spoke-east.vpc.azure_vnet_resource_id | |
ip_address = aviatrix_gateway.ingress-gw-east.private_ip | |
} | |
resource "azurerm_lb_rule" "ingress-east-us-lb-rule" { | |
loadbalancer_id = azurerm_lb.ingress-east-us-lb.id | |
name = "LBRule" | |
protocol = "Tcp" | |
frontend_port = "80" | |
backend_port = "80" | |
frontend_ip_configuration_name = "PublicIPAddress" | |
probe_id = azurerm_lb_probe.ingress-east-us-lb-probe.id | |
backend_address_pool_ids = ["${azurerm_lb_backend_address_pool.ingress-east-us-lb-backend.id}"] | |
enable_floating_ip = true | |
} | |
resource "azurerm_lb_backend_address_pool" "ingress-east-us-lb-backend" { | |
loadbalancer_id = azurerm_lb.ingress-east-us-lb.id | |
name = "BackEndPool" | |
} | |
resource "azurerm_resource_group" "ingress-central-us-lb-rg" { | |
name = "ingress-central-us-lb-rg" | |
location = var.region-a | |
} | |
resource "azurerm_public_ip" "ingress-central-us-lb-pip" { | |
name = "ingress-central-us-lb-pip" | |
resource_group_name = azurerm_resource_group.ingress-central-us-lb-rg.name | |
location = azurerm_resource_group.ingress-central-us-lb-rg.location | |
allocation_method = "Static" | |
sku = "Standard" | |
} | |
resource "azurerm_lb" "ingress-central-us-lb" { | |
name = "ingress-central-us-lb" | |
location = azurerm_resource_group.ingress-central-us-lb-rg.location | |
resource_group_name = azurerm_resource_group.ingress-central-us-lb-rg.name | |
sku = "Standard" | |
frontend_ip_configuration { | |
name = "PublicIPAddress" | |
public_ip_address_id = azurerm_public_ip.ingress-central-us-lb-pip.id | |
} | |
} | |
resource "azurerm_lb_probe" "ingress-central-us-lb-probe" { | |
loadbalancer_id = azurerm_lb.ingress-central-us-lb.id | |
name = "ingress-central-us-lb-probe" | |
port = "443" | |
} | |
resource "azurerm_lb_backend_address_pool_address" "azurerm_lb_backend_address_pool_address-ingress-gw-central" { | |
name = "ingress-gw-central" | |
backend_address_pool_id = azurerm_lb_backend_address_pool.ingress-central-us-lb-backend.id | |
virtual_network_id = module.ingress-spoke-central.vpc.azure_vnet_resource_id | |
ip_address = aviatrix_gateway.ingress-gw-central.private_ip | |
} | |
resource "azurerm_lb_rule" "ingress-central-us-lb-rule" { | |
loadbalancer_id = azurerm_lb.ingress-central-us-lb.id | |
name = "LBRule" | |
protocol = "Tcp" | |
frontend_port = "80" | |
backend_port = "80" | |
frontend_ip_configuration_name = "PublicIPAddress" | |
probe_id = azurerm_lb_probe.ingress-central-us-lb-probe.id | |
backend_address_pool_ids = ["${azurerm_lb_backend_address_pool.ingress-central-us-lb-backend.id}"] | |
enable_floating_ip = true | |
} | |
resource "azurerm_lb_backend_address_pool" "ingress-central-us-lb-backend" { | |
loadbalancer_id = azurerm_lb.ingress-central-us-lb.id | |
name = "BackEndPool" | |
} | |
resource "azurerm_resource_group" "east-us-lb-rg" { | |
name = "east-us-lb-rg" | |
location = var.region-b | |
} | |
resource "azurerm_lb" "east-us-lb" { | |
name = "east-us-lb" | |
location = azurerm_resource_group.east-us-lb-rg.location | |
resource_group_name = azurerm_resource_group.east-us-lb-rg.name | |
sku = "Standard" | |
frontend_ip_configuration { | |
name = "PublicIPAddress" | |
subnet_id = module.app-spoke-east.vpc.public_subnets[1].subnet_id | |
} | |
} | |
resource "azurerm_lb_probe" "east-us-lb-probe" { | |
loadbalancer_id = azurerm_lb.east-us-lb.id | |
name = "east-us-lb-probe" | |
port = "80" | |
} | |
resource "azurerm_lb_backend_address_pool_address" "azurerm_lb_backend_address_pool_address-east-app-vm1" { | |
name = "east-app-vm1" | |
backend_address_pool_id = azurerm_lb_backend_address_pool.east-us-lb-backend.id | |
virtual_network_id = module.app-spoke-east.vpc.azure_vnet_resource_id | |
ip_address = azurerm_network_interface.east-app-vm1-nic.private_ip_address | |
} | |
resource "azurerm_lb_backend_address_pool_address" "azurerm_lb_backend_address_pool_address-east-app-vm2" { | |
name = "east-app-vm2" | |
backend_address_pool_id = azurerm_lb_backend_address_pool.east-us-lb-backend.id | |
virtual_network_id = module.app-spoke-east.vpc.azure_vnet_resource_id | |
ip_address = azurerm_network_interface.east-app-vm2-nic.private_ip_address | |
} | |
resource "azurerm_lb_rule" "east-us-lb-rule" { | |
loadbalancer_id = azurerm_lb.east-us-lb.id | |
name = "LBRule" | |
protocol = "Tcp" | |
frontend_port = "80" | |
backend_port = "80" | |
frontend_ip_configuration_name = "PublicIPAddress" | |
probe_id = azurerm_lb_probe.east-us-lb-probe.id | |
backend_address_pool_ids = ["${azurerm_lb_backend_address_pool.east-us-lb-backend.id}"] | |
} | |
resource "azurerm_lb_backend_address_pool" "east-us-lb-backend" { | |
loadbalancer_id = azurerm_lb.east-us-lb.id | |
name = "BackEndPool" | |
} | |
resource "azurerm_resource_group" "central-us-lb-rg" { | |
name = "central-us-lb-rg" | |
location = var.region-a | |
} | |
resource "azurerm_lb" "central-us-lb" { | |
name = "central-us-lb" | |
location = azurerm_resource_group.central-us-lb-rg.location | |
resource_group_name = azurerm_resource_group.central-us-lb-rg.name | |
sku = "Standard" | |
frontend_ip_configuration { | |
name = "PublicIPAddress" | |
subnet_id = module.app-spoke-central.vpc.public_subnets[1].subnet_id | |
} | |
} | |
resource "azurerm_lb_probe" "central-us-lb-probe" { | |
loadbalancer_id = azurerm_lb.central-us-lb.id | |
name = "central-us-lb-probe" | |
port = "80" | |
} | |
resource "azurerm_lb_backend_address_pool_address" "azurerm_lb_backend_address_pool_address-central-app-vm1" { | |
name = "central-app-vm1" | |
backend_address_pool_id = azurerm_lb_backend_address_pool.central-us-lb-backend.id | |
virtual_network_id = module.app-spoke-central.vpc.azure_vnet_resource_id | |
ip_address = azurerm_network_interface.central-app-vm1-nic.private_ip_address | |
} | |
resource "azurerm_lb_backend_address_pool_address" "azurerm_lb_backend_address_pool_address-central-app-vm2" { | |
name = "central-app-vm2" | |
backend_address_pool_id = azurerm_lb_backend_address_pool.central-us-lb-backend.id | |
virtual_network_id = module.app-spoke-central.vpc.azure_vnet_resource_id | |
ip_address = azurerm_network_interface.central-app-vm2-nic.private_ip_address | |
} | |
resource "azurerm_lb_rule" "central-us-lb-rule" { | |
loadbalancer_id = azurerm_lb.central-us-lb.id | |
name = "LBRule" | |
protocol = "Tcp" | |
frontend_port = "80" | |
backend_port = "80" | |
frontend_ip_configuration_name = "PublicIPAddress" | |
probe_id = azurerm_lb_probe.central-us-lb-probe.id | |
backend_address_pool_ids = ["${azurerm_lb_backend_address_pool.central-us-lb-backend.id}"] | |
} | |
resource "azurerm_lb_backend_address_pool" "central-us-lb-backend" { | |
loadbalancer_id = azurerm_lb.central-us-lb.id | |
name = "BackEndPool" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment