I got a warning in Azure Portal that my load balancer "is on Basic SKU which will be retired on 30 September 2025. Learn more about Standard SKU and migration steps."
I have been trying to find without success how to upgrade my Terraform code.
This is my Terraform:
resource "azurerm_lb" "foo" {
name = "foo-${var.URL_NAME}"
frontend_ip_configuration {
name = "PublicIPAddress"
public_ip_address_id = azurerm_public_ip.foo_lb_ip.id
}
location = var.AZURE_REGION
resource_group_name = data.azurerm_resource_group.foo.name
}
resource "azurerm_lb_backend_address_pool" "foo" {
name = "BackEndAddressPool"
loadbalancer_id = azurerm_lb.foo.id
}
resource "azurerm_network_interface_backend_address_pool_association" "foo" {
count = var.NUMBER_OF_VMS
backend_address_pool_id = azurerm_lb_backend_address_pool.foo.id
ip_configuration_name = "internal"
network_interface_id = azurerm_network_interface.foo[count.index].id
}
resource "azurerm_lb_probe" "foo" {
name = "foo-${var.URL_NAME}"
protocol = "Tcp"
port = 9999
loadbalancer_id = azurerm_lb.foo.id
}
resource "azurerm_lb_rule" "foo" {
name = "foo-${var.URL_NAME}"
protocol = "Tcp"
frontend_port = 9999
backend_port = 9999
frontend_ip_configuration_name = azurerm_lb.foo.frontend_ip_configuration[0].name
loadbalancer_id = azurerm_lb.foo.id
backend_address_pool_ids = [azurerm_lb_backend_address_pool.foo.id]
}
resource "azurerm_public_ip" "foo_lb_ip" {
name = "foo-lb-ip"
allocation_method = "Dynamic"
location = var.AZURE_REGION
resource_group_name = data.azurerm_resource_group.foo.name
}
2
Answers
To update
Azure's Load Balancer
from Basic to Standard, you need to change theLB SKU
to ‘Standard’ and ensure that the public IP SKU is also ‘Standard’. Only then will theLoad Balancer
be updated toStandard.
Here is Terraform code to update
Azure Load balancer
SKU toStandard
Terraform apply:
After executing the terraform script, The
Azure Load balancer SKU
has been changed to StandardAlternatively, you can also use
PowerShell code
in terraform by using null resource block to upgradeload balancer sku
toStandard
. below is the terraform code withnull resource
You need to add the following to your terraform file:
I used this documentation has reference : docs