Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

terraform: azure remove unused lb backends #3270

Merged
merged 1 commit into from
Jul 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions terraform/infrastructure/azure/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ module "loadbalancer_backend_control_plane" {
ports = local.ports
}

# We cannot delete them right away since we first need to to delete the dependency from the VMSS to this backend pool.
# TODO(@3u13r): Remove this resource after v2.18.0 has been released.
module "loadbalancer_backend_worker" {
source = "./modules/load_balancer_backend"

Expand All @@ -179,11 +181,14 @@ module "loadbalancer_backend_worker" {
ports = []
}

# We cannot delete them right away since we first need to to delete the dependency from the VMSS to this backend pool.
# TODO(@3u13r): Remove this resource after v2.18.0 has been released.
resource "azurerm_lb_backend_address_pool" "all" {
loadbalancer_id = azurerm_lb.loadbalancer.id
name = "${var.name}-all"
}


resource "azurerm_virtual_network" "network" {
name = local.name
resource_group_name = var.resource_group
Expand Down Expand Up @@ -257,14 +262,14 @@ module "scale_set_group" {
image_id = var.image_id
network_security_group_id = azurerm_network_security_group.security_group.id
subnet_id = azurerm_subnet.node_subnet.id
backend_address_pool_ids = each.value.role == "control-plane" ? [
azurerm_lb_backend_address_pool.all.id,
module.loadbalancer_backend_control_plane.backendpool_id
] : [
azurerm_lb_backend_address_pool.all.id,
module.loadbalancer_backend_worker.backendpool_id
]
marketplace_image = var.marketplace_image
backend_address_pool_ids = each.value.role == "control-plane" ? [module.loadbalancer_backend_control_plane.backendpool_id] : []
marketplace_image = var.marketplace_image

# We still depend on the backends, since we are not sure if the VMs inside the VMSS have been
# "updated" to the new version (note: this is the update in Azure which "refreshes" the NICs and not
# our Constellation update).
# TODO(@3u13r): Remove this dependency after v2.18.0 has been released.
depends_on = [module.loadbalancer_backend_worker, azurerm_lb_backend_address_pool.all]
}

module "jump_host" {
Expand Down