IBM-Cloud / terraform-provider-ibm

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

Terraform plan creation with 1000 instances/volumes takes awhile #1140

Open argeiger opened 4 years ago

argeiger commented 4 years ago

Terraform Version

Terraform v0.12.20

Affected Resource(s)

Please list the resources as a list, for example:

Terraform Configuration Files

I have 1000 instances with each having a data volume created and attached

  # module.vpc.ibm_is_volume.volumes["ts-us-east-3-subnet-4-18"] will be created
  + resource "ibm_is_volume" "volumes" {
      + capacity                = 25
      + crn                     = (known after apply)
      + encryption_key          = (known after apply)
      + id                      = (known after apply)
      + iops                    = (known after apply)
      + name                    = "ts-us-east-3-subnet-4-18"
      + profile                 = "5iops-tier"
      + resource_controller_url = (known after apply)
      + resource_crn            = (known after apply)
      + resource_group          = (known after apply)
      + resource_group_name     = (known after apply)
      + resource_name           = (known after apply)
      + resource_status         = (known after apply)
      + status                  = (known after apply)
      + tags                    = (known after apply)
      + zone                    = "us-east-3"
    }

Expected Behavior

Plan to have been generated in a quicker period of time

Actual Behavior

Took approximately 10 minutes for the plan to be created:

real 9m36.350s user 15m9.592s sys 0m31.630s

Without the volumes and 1000 instances, it took: real 0m17.743s user 0m20.522s sys 0m4.127s

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. Create a terraform configuration with 1000 VPC NextGen instances and 1000 VPC NextGen volumes
  2. Run terraform plan
ujjwal-ibm commented 4 months ago

I tried this, with 1000 data volumes and 1000 vsi.

variable "count" {
  default = 1000

}
resource "ibm_is_volume" "storage" {
  count   = var.count
  name    = "${var.name}-vol-${count.index}"
  profile = "10iops-tier"
  zone    = "us-south-1"
}

resource "ibm_is_instance" "testacc_instance" {
  count   = var.count
  name    = "${var.name}-vsi-${count.index}"
  image   = "2erf3f33dd3d33d3dd33"
  profile = "bx2-2x8"
  primary_network_interface {
    subnet = "0ederervevrver"
  }
  vpc     = "vervrevveewewwedwsxcscscdf"
  zone    = "us-south-1"
  keys    = ["34rf33rvrcvvrervefdecc"]
  volumes = [ibm_is_volume.storage[count.index].id]
}

was able to plan in 1 mins

2024-05-16T14:33:06.272+0530 [INFO]  backend/local: starting Plan operation
....
2024-05-16T14:34:17.956+0530 [INFO]  backend/local: plan operation completed