IBM-Cloud / terraform-provider-ibm

https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs
Mozilla Public License 2.0
339 stars 662 forks source link

IBM VSI took long time to destroy #818

Closed ganhuang closed 2 years ago

ganhuang commented 4 years ago

Terraform Version

Terraform v0.11.11

Affected Resource(s)

Expected Behavior

The VSI should be destroyed immediately.

Actual Behavior

Some VSI took 30 mins or longer to be destroyed, which leads our pipeline continuously failed.

Steps to Reproduce

  1. terraform destroy

Important Factoids

This seems occurs very frequently lately. Previously the destroy process is pretty fast, and got finished immediately.

For now, some instances will take a long time to be destroyed by terraform. From the portal, I can see those instances are already Pending Transactions. But terraform still recognize them as Not Destroyed.

ganhuang commented 4 years ago

I'm not sure if it's an issue that terraform should handle, or simply an issue of IBM cloud. Please kindly let me what I can assist here.

stevestrutt commented 4 years ago

VSI's on Classic infrastructure (SoftLayer) are asynchronously deleted by SoftLayer. I believe there is a sweeper job that runs on a set timescale. Similarly I have seen them take up to 30 mins to disappear from the portal. My past experience is that the IBM Cloud API/Provider considers these as having been deleted and they do not affect future operations.

What issue is this causing in your pipeline?

ganhuang commented 4 years ago

we're using the bakery model to deploy our applications. So each time on the deployment, the instance will be re-created. If the provisioning/destroying time frame takes too long, that will make the whole deployment process lasts too long (we observed it took 6 hours even longer to destroy the instances in some cases by terraform)

This is the code sample:

resource "ibm_compute_vm_instance" "instances" {
  count = "${var.instance_count}"

  hostname = "xxxxx"
  domain   = "xxxxx"

  lifecycle {
    create_before_destroy = true
  }

  image_id                   = "xxx"
  flavor_key_name       = "x"
  datacenter                = "x"
  network_speed         = "x"
}
ganhuang commented 4 years ago

saying that destroying the instances is part of terraform apply, if it takes too long to complete, the pipeline would also get stuck there.

hkantare commented 2 years ago

closing the issue due to no recent activity. Please feel free to open new issue