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

"context deadline exceeded" while trying to create Azure LB Load balancing rule #26009

Open
1 task done
oleksandrmeleshchuk-epm opened this issue May 17, 2024 · 0 comments
Open
1 task done

Comments

@oleksandrmeleshchuk-epm
Copy link

oleksandrmeleshchuk-epm commented May 17, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment and review the contribution guide to help.

Terraform Version

1.8.3

AzureRM Provider Version

3.103.1

Affected Resource(s)/Data Source(s)

azurerm_lb_rule

Terraform Configuration Files

locals {
	rules_and_probs = flatten([
		for idx, obj in var.scalesets: [
			for env in var.envs: {
				lb_idx = idx
				env = env
			}
		]
	])
	filtered_rules_and_probes = length(var.scalesets) == 1 ? local.rules_and_probs : [for obj in local.rules_and_probs: obj if obj.lb_idx > 0 ]
}

resource "azurerm_public_ip" "example" {
	count = var.is_new_sec ? 0 : length(var.scalesets)

	name                = "nm_${var.customer_name}_ip_scaleset${count.index}"
	resource_group_name = var.rg
	location            = var.location
	domain_name_label   = "${var.sf_dnsname}-${count.index}"
	allocation_method   = "Dynamic"
	tags				= var.tags
}

resource "azurerm_lb" "example" {
	count = length(var.scalesets)

	name                = "nm_${var.customer_name}_lb_scaleset${count.index}"
	location            = var.location
	resource_group_name = var.rg
	sku 				= var.scalesets[count.index].lb_SKU
	tags 				= var.tags

	dynamic "frontend_ip_configuration" {
		for_each = var.is_new_sec ? []: [""]
		content {
			name                 = "FrontIPAddress"
			public_ip_address_id = azurerm_public_ip.example[count.index].id
		}
	}
	
	dynamic "frontend_ip_configuration" {
		for_each = var.is_new_sec ? [""]: []
		content {
			name                 = "FrontIPAddress"
			private_ip_address = var.scalesets[count.index].private_lb_ip
			subnet_id = var.scaleset_subnets_id[count.index]
			private_ip_address_allocation = "Static"
		}
	}
}

resource "azurerm_lb_backend_address_pool" "example" {
	count = length(var.scalesets)

	loadbalancer_id = azurerm_lb.example[count.index].id
	name            = "BackEndAddressPool"
}

resource "azurerm_lb_rule" "LBRule" {
	count = length(var.scalesets)

	loadbalancer_id                	= azurerm_lb.example[count.index].id
	name                           	= "LBRule"
	protocol                       	= var.lb_seed_proto
	frontend_port					= 19000
	backend_port					= 19000
	frontend_ip_configuration_name	= "FrontIPAddress"
	idle_timeout_in_minutes			= 5
	backend_address_pool_ids		= ["${azurerm_lb_backend_address_pool.example[count.index].id}"]
	probe_id 						= azurerm_lb_probe.FabricGatewayProbe[count.index].id
}

resource "azurerm_lb_rule" "LBHttpRule" {
	count = length(var.scalesets)

	loadbalancer_id                	= azurerm_lb.example[count.index].id
	name                           	= "LBHttpRule"
	protocol                       	= var.lb_seed_proto
	frontend_port                  	= 19080
	backend_port                   	= 19080
	frontend_ip_configuration_name 	= "FrontIPAddress"
	idle_timeout_in_minutes			= 5
	backend_address_pool_ids		= ["${azurerm_lb_backend_address_pool.example[count.index].id}"]
	probe_id 						= azurerm_lb_probe.FabricHttpGatewayProbe[count.index].id
}

resource "azurerm_lb_rule" "AppRule" {
	count = length(local.filtered_rules_and_probes)

	loadbalancer_id                	= azurerm_lb.example[local.filtered_rules_and_probes[count.index].lb_idx].id
	name                           	= "nM_LBRule_${local.filtered_rules_and_probes[count.index].env.portNumberFront}_${local.filtered_rules_and_probes[count.index].env.envName}"
	protocol                       	= var.lb_seed_proto
	frontend_port                  	= local.filtered_rules_and_probes[count.index].env.portNumberFront
	backend_port                  	= local.filtered_rules_and_probes[count.index].env.portNumber
	frontend_ip_configuration_name	= "FrontIPAddress"
	idle_timeout_in_minutes			= 30
	backend_address_pool_ids		= ["${azurerm_lb_backend_address_pool.example[local.filtered_rules_and_probes[count.index].lb_idx].id}"]
	probe_id 						= azurerm_lb_probe.AppProbe[count.index].id
}

resource "azurerm_lb_probe" "FabricGatewayProbe" {
	count = length(var.scalesets)

	loadbalancer_id     = azurerm_lb.example[count.index].id
	name                = "FabricGatewayProbe"
	protocol			= var.lb_seed_proto
	port                = 19000
	interval_in_seconds = 5
	number_of_probes	= 2
}

resource "azurerm_lb_probe" "FabricHttpGatewayProbe" {
	count = length(var.scalesets)

	loadbalancer_id     = azurerm_lb.example[count.index].id
	name                = "FabricHttpGatewayProbe"
	protocol			= var.lb_seed_proto
	port                = 19080
	interval_in_seconds = 5
	number_of_probes	= 2
}

resource "azurerm_lb_probe" "AppProbe" {
	count 							= length(local.filtered_rules_and_probes)

	loadbalancer_id     			= azurerm_lb.example[local.filtered_rules_and_probes[count.index].lb_idx].id
	name                			= "API_nM_LBProbe_${local.filtered_rules_and_probes[count.index].env.portNumber}"
	protocol						= var.lb_work_proto
	port                			= local.filtered_rules_and_probes[count.index].env.portNumber
	request_path					= var.lb_work_request_path
	interval_in_seconds 			= 5
	number_of_probes				= 2
}

resource "azurerm_lb_nat_pool" "VMss" {
	count = length(var.scalesets)

	resource_group_name            = var.rg
	loadbalancer_id                = azurerm_lb.example[count.index].id
	name                           = "LoadBalancerBEAddressNatPool"
	protocol                       = "Tcp"
	frontend_port_start            = 3389
	frontend_port_end              = 4500
	backend_port                   = 3389
	frontend_ip_configuration_name = "FrontIPAddress"
}

output "lb_nat_pool_ids" {
	value = azurerm_lb_nat_pool.VMss[*].id
}


output "lb_backend_address_pool_ids" {
	value = azurerm_lb_backend_address_pool.example[*].id
}

output "lb_ips"{
	value = azurerm_public_ip.example[*].fqdn
}

output "private_ips"{
	value = azurerm_lb.example[*].private_ip_address
}

Debug Output/Panic Output

module.nm-infra.module.lb.azurerm_lb_rule.LBHttpRule[0]: Still creating... [29m50s elapsed]
╷
│ Warning: Reference to undefined provider
│ 
│   on main.tf line 205, in module "nm-infra":
│  205: 		azurerm = azurerm
│ 
│ There is no explicit declaration for local provider name "azurerm" in
│ module.nm-infra, so Terraform is assuming you mean to pass a
│ configuration for "hashicorp/azurerm".
│ 
│ If you also control the child module, add a required_providers entry named
│ "azurerm" with the source address "hashicorp/azurerm".
│ 
│ (and 19 more similar warnings elsewhere)
╵
╷
│ Error: updating Load Balancing Rule (Subscription: "33e0b159-6c05-4fa1-962c-4f64eb2eb64d"
│ Resource Group Name: "nm-eirgrid-nonprod1a-33e0b159"
│ Load Balancer Name: "nm_eirgrid-nonprod1a_lb_scaleset0"
│ Load Balancing Rule Name: "LBHttpRule"): polling after CreateOrUpdate: context deadline exceeded
│ 
│   with module.nm-infra.module.lb.azurerm_lb_rule.LBHttpRule[0],
│   on .terraform/modules/nm-infra/modules/azure-loadbalancer/main.tf line 73, in resource "azurerm_lb_rule" "LBHttpRule":
│   73: resource "azurerm_lb_rule" "LBHttpRule" {

Expected Behaviour

Rule adding should be executed

Actual Behaviour

Azure LB Load balancing rules are created, but TF execution failing after 30 minutes timeout.

Steps to Reproduce

terraform apply

Important Factoids

No response

References

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant