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

Update pending error upon LoadBalancer creation #5124

Open
matihost opened this issue Feb 12, 2024 · 0 comments
Open

Update pending error upon LoadBalancer creation #5124

matihost opened this issue Feb 12, 2024 · 0 comments
Labels
service/VPC Infrastructure Issues related to the VPC Infrastructure

Comments

@matihost
Copy link

While creating LoadBalancer it randomly ends with:

ibm_is_lb_listener.public-alb-frontend-listener: Creating...

....


│ Error: [ERROR] Error while creating Load Balanacer Listener err The load balancer with ID 'r010-2e4dc309-e92f-40fd-bb1b-2b6015df618a' cannot be updated because its status is 'UPDATE_PENDING'.

attempt to ... retry again the Terraform... ends sucessful.

Proposal:

  • add some resilience to API call to introduce exponential backoff for UPDATE_PENDING errors

Sample terrraform code:

resource "ibm_is_lb" "public-alb" {
  resource_group = var.resource_group_id

  name = "${local.prefix}-alb-public"

  subnets = local.subnet_ids
  type = "public"

  security_groups = [ data.ibm_is_security_group.public-lb.id ]

}


resource "ibm_is_lb_listener" "public-alb-frontend-listener" {
  lb       = ibm_is_lb.public-alb.id
  protocol = "http"
  port     = 80
  default_pool = ibm_is_lb_pool.public-alb-backend-pool.id

  connection_limit = 1000
  idle_connection_timeout = 120
}


resource "ibm_is_lb_pool" "public-alb-backend-pool" {
  name                = "${local.prefix}-public-alb-pool-web"
  lb                  = ibm_is_lb.public-alb.id
  algorithm           = "round_robin"
  protocol            = "http"
  health_delay        = 5
  health_retries      = 2
  health_timeout      = 2
  health_type         = "http"
  health_monitor_port = "80"

  proxy_protocol      = "disabled"
  session_persistence_type = "source_ip"
}


resource "ibm_is_instance_group" "public-alb-ig" {
  resource_group = var.resource_group_id

  name              = "${local.prefix}-group-for-pub-alb"
  instance_template = ibm_is_instance_template.webserver.id
  instance_count    = 3
  subnets           = local.subnet_ids

  application_port = 80
  load_balancer = ibm_is_lb.public-alb.id
  load_balancer_pool =  element(split("/", ibm_is_lb_pool.public-alb-backend-pool.id), 1)


  lifecycle {
    ignore_changes = [
      instance_count,
    ]
  }
}

resource "ibm_is_instance_group_manager" "public-alb-igm" {
  name               = "${local.prefix}-igm-for-pub-alb"
  aggregation_window = 120
  instance_group     = ibm_is_instance_group.public-alb-ig.id
  cooldown             = 120
  manager_type         = "autoscale"
  enable_manager       = true
  max_membership_count = 6

  min_membership_count = 1
}

resource "ibm_is_instance_group_manager_policy" "public-alb-target-cpu" {
  name                   = "${local.prefix}-igm-policy-for-pub-alb"
  instance_group         = ibm_is_instance_group.public-alb-ig.id
  instance_group_manager = ibm_is_instance_group_manager.public-alb-igm.manager_id
  metric_type            = "cpu"
  metric_value           = 70
  policy_type            = "target"
}
@github-actions github-actions bot added the service/VPC Infrastructure Issues related to the VPC Infrastructure label Feb 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
service/VPC Infrastructure Issues related to the VPC Infrastructure
Projects
None yet
Development

No branches or pull requests

1 participant