Reputation: 5
I'm grappling with a complex issue while configuring an Azure Load Balancer backend address pool address using Terraform. The error message I'm encountering is as follows:
Error: Error creating LB Backend Address: Error updating Backend Address: (Azure Error) StatusCode=404
I have double-checked my resource dependencies, and all resources (azurerm_resource_group.example, azurerm_lb.example, azurerm_lb_backend_address_pool.example) exist and are correctly configured. However, Terraform seems to encounter an issue when configuring the backend address pool address. Can someone help me identify the root cause of this error and provide a solution to resolve it?
Issue while creating azurerm_lb_backend_address_pool_address
Upvotes: 0
Views: 665
Reputation: 2331
I tried to provision the configuration of Azure Load Balancer Backend Address Pool Address and I was able to provision the requirement successfully.
The error message you're encountering, StatusCode=404
, typically indicates that Terraform is trying to update or create a resource that doesn't exist in Azure. To help you further, I'll provide a Terraform configuration that sets up an Azure Load Balancer with a backend address pool and explain the critical parts of the configuration.
Another cause for this can be checked by the Creation of a Public IP with SKU Type as "Standard". Retry checked all the parameters that match the placeholders as the code I was trying to run was a demo one.
My terraform configuration
data "azurerm_resource_group" "example" {
name = "LoadBalancerRGvk"
}
resource "azurerm_network_security_group" "example" {
name = "demovk-security-group"
location = data.azurerm_resource_group.example.location
resource_group_name = data.azurerm_resource_group.example.name
}
resource "azurerm_virtual_network" "example" {
name = "demovk-network"
location = data.azurerm_resource_group.example.location
resource_group_name = data.azurerm_resource_group.example.name
address_space = ["10.0.0.0/16"]
dns_servers = ["10.0.0.4", "10.0.0.5"]
subnet {
name = "subnet1"
address_prefix = "10.0.1.0/24"
}
subnet {
name = "subnet2"
address_prefix = "10.0.2.0/24"
security_group = azurerm_network_security_group.example.id
}
}
data "azurerm_lb" "example" {
name = "TestLoadBalancervk"
resource_group_name = data.azurerm_resource_group.example.name
}
data "azurerm_lb_backend_address_pool" "example" {
name = "BackEndAddressPoolvk"
loadbalancer_id = data.azurerm_lb.example.id
}
resource "azurerm_lb_backend_address_pool_address" "example" {
name = "demovksb"
backend_address_pool_id = data.azurerm_lb_backend_address_pool.example.id
virtual_network_id = azurerm_virtual_network.example.id
ip_address = "10.0.0.1"
}
Output:
Upvotes: 0