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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

azurerm_lb_rule error performing CreateOrUpdate: unexpected status 429 (429 Too Many Requests) with error: RetryableError: A retryable error occurred. #25417

Open
1 task done
masterofimages opened this issue Mar 26, 2024 · 3 comments

Comments

@masterofimages
Copy link

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.2.6

AzureRM Provider Version

3.97.1

Affected Resource(s)/Data Source(s)

azurerm_lb_rule

Terraform Configuration Files

resource "azurerm_lb" "sql_ilb" {
  count               = var.high_availability_enabled ? 1 : 0
  name                = format("ilb-%s-%s-%s-%s", local.sql_group, var.sql_service_name, var.location, var.env)
  location            = var.location
  resource_group_name = var.resource_group_name
  sku                 = "Standard"

  frontend_ip_configuration {
    name                          = local.listener_frontend_name
    subnet_id                     = data.azurerm_subnet.sql.id
    private_ip_address_allocation = "Dynamic"
  }

  frontend_ip_configuration {
    name                          = local.listener_wsfc_name
    subnet_id                     = data.azurerm_subnet.sql.id
    private_ip_address_allocation = "Dynamic"
  }

  tags = local.tags
}

resource "azurerm_lb_backend_address_pool" "sql_be" {
  count           = var.high_availability_enabled ? 1 : 0
  loadbalancer_id = azurerm_lb.sql_ilb[count.index].id
  name            = format("backend-%s-%s-%s-%s", local.sql_group, var.sql_service_name, var.location, var.env)
}

resource "azurerm_network_interface_backend_address_pool_association" "sql_ap_assoc" {
  count                   = var.high_availability_enabled ? var.sql_count : 0
  network_interface_id    = azurerm_network_interface.this[count.index].id
  ip_configuration_name   = element(azurerm_network_interface.this[count.index].ip_configuration[*].name, count.index)
  backend_address_pool_id = azurerm_lb_backend_address_pool.sql_be[0].id
}

resource "azurerm_lb_probe" "wsfc_probe" {
  count           = var.high_availability_enabled ? 1 : 0
  loadbalancer_id = azurerm_lb.sql_ilb[count.index].id
  name            = "WSFCEndPointProbe"
  port            = 58888
}

resource "azurerm_lb_probe" "sql_probe" {
  count           = var.high_availability_enabled ? 1 : 0
  loadbalancer_id = azurerm_lb.sql_ilb[count.index].id
  name            = "SQLAlwaysOnEndPointProbe"
  port            = 59999
}

resource "azurerm_lb_rule" "sql_wsfc_rule" {
  count                          = var.high_availability_enabled ? 1 : 0
  loadbalancer_id                = azurerm_lb.sql_ilb[count.index].id
  backend_address_pool_ids       = [azurerm_lb_backend_address_pool.sql_be[count.index].id]
  name                           = "WSFCEndPointListener"
  protocol                       = "Tcp"
  frontend_port                  = 2130
  backend_port                   = 2130
  probe_id                       = azurerm_lb_probe.wsfc_probe[count.index].id
  enable_floating_ip             = true
  frontend_ip_configuration_name = local.listener_wsfc_name
}

resource "azurerm_lb_rule" "sql_a_rule" {
  count                          = var.high_availability_enabled ? 1 : 0
  loadbalancer_id                = azurerm_lb.sql_ilb[count.index].id
  backend_address_pool_ids       = [azurerm_lb_backend_address_pool.sql_be[count.index].id]
  name                           = "SQLAlwaysOnEndPointListener"
  protocol                       = "Tcp"
  frontend_port                  = 2130
  backend_port                   = 2130
  probe_id                       = azurerm_lb_probe.sql_probe[count.index].id
  enable_floating_ip             = true
  frontend_ip_configuration_name = local.listener_frontend_name
}

resource "azurerm_lb_rule" "sql_ssas_rule" {
  count                          = var.high_availability_enabled && var.ssas_enabled ? 1 : 0
  loadbalancer_id                = azurerm_lb.sql_ilb[count.index].id
  backend_address_pool_ids       = [azurerm_lb_backend_address_pool.sql_be[count.index].id]
  name                           = "SQLAlwaysOnSSAS"
  protocol                       = "Tcp"
  frontend_port                  = 2383
  backend_port                   = 2383
  probe_id                       = azurerm_lb_probe.sql_probe[count.index].id
  enable_floating_ip             = true
  frontend_ip_configuration_name = local.listener_frontend_name
}

resource "azurerm_lb_rule" "ssas_browser_rule" {
  count                          = var.high_availability_enabled && var.ssas_enabled ? 1 : 0
  loadbalancer_id                = azurerm_lb.sql_ilb[count.index].id
  backend_address_pool_ids       = [azurerm_lb_backend_address_pool.sql_be[count.index].id]
  name                           = "SSASBrowser"
  protocol                       = "Tcp"
  frontend_port                  = 2382
  backend_port                   = 2382
  probe_id                       = azurerm_lb_probe.sql_probe[count.index].id
  enable_floating_ip             = true
  frontend_ip_configuration_name = local.listener_frontend_name
}

resource "azurerm_lb_rule" "sql_browser_rule" {
  count                          = var.high_availability_enabled ? 1 : 0
  loadbalancer_id                = azurerm_lb.sql_ilb[count.index].id
  backend_address_pool_ids       = [azurerm_lb_backend_address_pool.sql_be[count.index].id]
  name                           = "SQLBrowser"
  protocol                       = "Udp"
  frontend_port                  = 1434
  backend_port                   = 1434
  probe_id                       = azurerm_lb_probe.sql_probe[count.index].id
  enable_floating_ip             = true
  frontend_ip_configuration_name = local.listener_frontend_name
}

Debug Output/Panic Output

Error: updating Load Balancing Rule (Subscription: "***"
Resource Group Name: "rg-tfmssql--1378-TestMssqlServerModule-Server-2019"
Load Balancer Name: "ilb-sql-c0cb-uksouth-dev"
Load Balancing Rule Name: "WSFCEndPointListener"): performing CreateOrUpdate: unexpected status 429 (429 Too Many Requests) with error: RetryableError: A retryable error occurred.

  with module.mssql_server.module.mssql_server.azurerm_lb_rule.sql_wsfc_rule[0],
  on ../../network.tf line 68, in resource "azurerm_lb_rule" "sql_wsfc_rule":
  68: resource "azurerm_lb_rule" "sql_wsfc_rule" {
}

Expected Behaviour

Terraform apply should succeed and the load-balancer rule should be created with no errors.

Actual Behaviour

Terraform apply fails.

Steps to Reproduce

terraform apply

Important Factoids

No response

References

No response

@sinbai
Copy link
Contributor

sinbai commented Mar 27, 2024

Hi @masterofimages thanks for opening this issue. Unfortunately, I could not reproduce this issue with the following TF config. Could you please provide the minimal reproducible TF config (containing dependent resources and variable values) of this issue so that we could reproduce /troubleshoot?


terraform {
  required_providers {
    azurerm = {
      source = "hashicorp/azurerm"
      version = "3.97.1"
    }
  }
}


provider "azurerm" {
  features {}
}

resource "azurerm_resource_group" "test" {
  name     = "test-rg-0327-25417"
  location = "eastus"
 

}

resource "azurerm_virtual_network" "test" {
  name                = "acctest-vnet-0327"
  resource_group_name = "${azurerm_resource_group.test.name}"
  address_space       = ["10.0.0.0/16"]
  location            = "${azurerm_resource_group.test.location}"
}

resource "azurerm_subnet" "test" {
  name                 = "subnet-0327"
  resource_group_name  = "${azurerm_resource_group.test.name}"
  virtual_network_name = "${azurerm_virtual_network.test.name}"
  address_prefixes     = ["10.0.0.0/24"]
}

resource "azurerm_lb" "sql_ilb" {
  name                = "sqlIlb0327"
  location            = azurerm_resource_group.test.location
  resource_group_name = azurerm_resource_group.test.name
  sku                 = "Standard"

  frontend_ip_configuration {
    name                          = "frontend_name"
    subnet_id                     = azurerm_subnet.test.id
    private_ip_address_allocation = "Dynamic"
  }

  frontend_ip_configuration {
    name                          = "wsfc_name"
    subnet_id                     = azurerm_subnet.test.id
    private_ip_address_allocation = "Dynamic"
  }


}

resource "azurerm_lb_backend_address_pool" "sql_be" {
  loadbalancer_id = azurerm_lb.sql_ilb.id
  name            = "sqlbe"
}

resource "azurerm_network_interface" "test" {
  name                = "acctestNIC-0327"
  location            = azurerm_resource_group.test.location
  resource_group_name = azurerm_resource_group.test.name

  ip_configuration {
    name                          = "vm-0327d"
    subnet_id                     = azurerm_subnet.test.id
    private_ip_address_allocation = "Dynamic"
  }
}

resource "azurerm_network_interface_backend_address_pool_association" "sql_ap_assoc" {
  network_interface_id    = azurerm_network_interface.test.id
  ip_configuration_name   = "vm-0327d"
  backend_address_pool_id = azurerm_lb_backend_address_pool.sql_be.id
}

resource "azurerm_lb_probe" "wsfc_probe" {
  loadbalancer_id = azurerm_lb.sql_ilb.id
  name            = "WSFCEndPointProbe"
  port            = 58888
}

resource "azurerm_lb_probe" "sql_probe" {
  loadbalancer_id = azurerm_lb.sql_ilb.id
  name            = "SQLAlwaysOnEndPointProbe"
  port            = 59999
}

resource "azurerm_lb_rule" "sql_wsfc_rule" {
  loadbalancer_id                = azurerm_lb.sql_ilb.id
  backend_address_pool_ids       = [azurerm_lb_backend_address_pool.sql_be.id]
  name                           = "WSFCEndPointListener"
  protocol                       = "Tcp"
  frontend_port                  = 2130
  backend_port                   = 2130
  probe_id                       = azurerm_lb_probe.wsfc_probe.id
  enable_floating_ip             = true
  frontend_ip_configuration_name = "wsfc_name"
}

resource "azurerm_lb_rule" "sql_a_rule" {
  loadbalancer_id                = azurerm_lb.sql_ilb.id
  backend_address_pool_ids       = [azurerm_lb_backend_address_pool.sql_be.id]
  name                           = "SQLAlwaysOnEndPointListener"
  protocol                       = "Tcp"
  frontend_port                  = 2130
  backend_port                   = 2130
  probe_id                       = azurerm_lb_probe.sql_probe.id
  enable_floating_ip             = true
  frontend_ip_configuration_name = "frontend_name"
}

resource "azurerm_lb_rule" "sql_ssas_rule" {
  loadbalancer_id                = azurerm_lb.sql_ilb.id
  backend_address_pool_ids       = [azurerm_lb_backend_address_pool.sql_be.id]
  name                           = "SQLAlwaysOnSSAS"
  protocol                       = "Tcp"
  frontend_port                  = 2383
  backend_port                   = 2383
  probe_id                       = azurerm_lb_probe.sql_probe.id
  enable_floating_ip             = true
  frontend_ip_configuration_name = "frontend_name"
}

resource "azurerm_lb_rule" "ssas_browser_rule" {
  loadbalancer_id                = azurerm_lb.sql_ilb.id
  backend_address_pool_ids       = [azurerm_lb_backend_address_pool.sql_be.id]
  name                           = "SSASBrowser"
  protocol                       = "Tcp"
  frontend_port                  = 2382
  backend_port                   = 2382
  probe_id                       = azurerm_lb_probe.sql_probe.id
  enable_floating_ip             = true
  frontend_ip_configuration_name = "frontend_name"
}

resource "azurerm_lb_rule" "sql_browser_rule" {
  loadbalancer_id                = azurerm_lb.sql_ilb.id
  backend_address_pool_ids       = [azurerm_lb_backend_address_pool.sql_be.id]
  name                           = "SQLBrowser"
  protocol                       = "Udp"
  frontend_port                  = 1434
  backend_port                   = 1434
  probe_id                       = azurerm_lb_probe.sql_probe.id
  enable_floating_ip             = true
  frontend_ip_configuration_name = "frontend_name"
}

Test result:
image

@DuyAnhBK
Copy link

DuyAnhBK commented Apr 3, 2024

I had same problem, just run terraform apply again, because some case in the first time you run apply, too many request to azure resource and maybe missing the response.

@adin3d
Copy link

adin3d commented Apr 4, 2024

we also have the same issue, it works if you run it again but unfortunately that is a big issue :(

terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "3.97.1"
}
}
}

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

5 participants