terraform-provider-ibm icon indicating copy to clipboard operation
terraform-provider-ibm copied to clipboard

ibm_container_alb_create doesn't create more than one ALB during apply

Open Borys-Kuncewicz opened this issue 2 years ago • 6 comments

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 other comments that do not add relevant new information or questions, 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

Terraform CLI and Terraform IBM Provider Version

Terraform v0.13.5 IBM Provider 1.50.0

Affected Resource(s)

  • ibm_container_alb_create

Terraform Configuration Files

resource "ibm_container_alb_create" "dal10_alb" {
  cluster  = ibm_container_cluster.cluster.id
  enable   = true
  alb_type = "private"
  vlan_id  = ibm_network_vlan.dal10_private_vlan.id
  zone     = "dal10"
}

resource "ibm_container_alb_create" "dal12_alb" {
  cluster  = ibm_container_cluster.cluster.id
  enable   = true
  alb_type = "private"
  vlan_id  = ibm_network_vlan.dal12_private_vlan.id
  zone     = "dal12"
}

Expected Behavior

Terraform should have created two ALBs.

Actual Behavior

Terraform created both ALBs with the same ID, resulting in dal10 ALB overwritting DAL12 ALB. Finally there's only one ALB created.

ibm_container_alb_create.d12_private: Creation complete after 3s [id=private-xxxxxxxxx-alb7] ibm_container_alb_create.d10_private: Creation complete after 3s [id=private-xxxxxxxxx-alb7]

Steps to Reproduce

  • Create more than one ALB with Terraform

Borys-Kuncewicz avatar Oct 26 '23 07:10 Borys-Kuncewicz

@attilatabori Can you look into this

hkantare avatar Oct 27 '23 13:10 hkantare

As a workaround can we run creation of alb in sequential way by adding depends_on

resource "ibm_container_alb_create" "dal10_alb" {
  cluster  = ibm_container_cluster.cluster.id
  enable   = true
  alb_type = "private"
  vlan_id  = ibm_network_vlan.dal10_private_vlan.id
  zone     = "dal10"
}

resource "ibm_container_alb_create" "dal12_alb" {
 depends_on = [ibm_container_alb_create.dal10_alb]
  cluster  = ibm_container_cluster.cluster.id
  enable   = true
  alb_type = "private"
  vlan_id  = ibm_network_vlan.dal12_private_vlan.id
  zone     = "dal12"
}

hkantare avatar Oct 27 '23 13:10 hkantare

The issue seems is not in the terraform provider, but beyond the API. Internal issue raised and investagtion ongoing.

attilatabori avatar Oct 30 '23 10:10 attilatabori

It looks like a synchronization problem; we've seen that in the past for kp, but I couldn't find a reference (sorry).

Also, it looks like the destruction is not working either:

module.this.ibm_container_alb_create.private["osa22"]: Destroying... [id=private-crcOMISSIS-alb4]
module.this.ibm_container_alb_create.private["osa23"]: Destroying... [id=private-crcOMISSIS-alb4]
module.this.ibm_container_alb_create.private["osa21"]: Destroying... [id=private-crcOMISSIS-alb4]
module.this.ibm_container_alb_create.private["osa23"]: Destruction complete after 0s
module.this.ibm_container_alb_create.private["osa21"]: Destruction complete after 0s
module.this.ibm_container_alb_create.private["osa22"]: Destruction complete after 0s
Releasing state lock. This may take a few moments...

Apply complete! Resources: 0 added, 0 changed, 3 destroyed.

but

❯ ibmcloud ks ingress alb ls -c OMISSIS | awk 'NR==2 || /alb4/ {print $0}'
ALB ID                                Enabled   State     Type      ALB IP          Zone    Build            ALB VLAN ID   NLB Version   Status
private-crcOMISSIS-alb4               true      enabled   private   10.8.18.4       osa21   1.8.4_5644_iks   3241682       1.0           healthy

ALBs cannot be destroyed at all, only disabled.

blacksd avatar Nov 14 '23 17:11 blacksd

once the ALB-s are created, it cannot be destroyed, only disable them. It is also under refactor. But currently there is no way to get rid of them.

attilatabori avatar Nov 15 '23 08:11 attilatabori

Hello!

@Borys-Kuncewicz can you retry this now? We released a possible ALB create fix. Thanks!

szombi avatar Nov 30 '23 12:11 szombi