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

ibm_is_instance_volume_attachment - Multiple volume creation and attachment failure #3077

Closed
jjordana27 opened this issue Sep 7, 2021 · 5 comments · Fixed by #3084
Closed
Labels
service/VPC Infrastructure Issues related to the VPC Infrastructure

Comments

@jjordana27
Copy link

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 v1.0.3 on windows_amd64
provider registry.terraform.io/ibm-cloud/ibm v1.31.0

Affected Resource(s)

resource ibm_is_instance_volume_attachment

Terraform Configuration Files

config:

terraform {
  required_providers {
    ibm = {
      source = "IBM-Cloud/ibm"
      version = ">= 1.12.0"
    }
  }
}

# Configure the IBM Provider
provider "ibm" {
  region = "eu-de"
}

resource "ibm_is_instance" "testacc_instance" {
  resource_group = var.instance.resource_group
  name    = var.instance.name
  image   = var.instance.image
  profile = var.instance.profile
  primary_network_interface {
    subnet = var.instance.primary_network_interface.subnet
    primary_ipv4_address = var.instance.primary_network_interface.primary_ipv4_address
    allow_ip_spoofing = false
  }
  vpc  = var.instance.vpc
  zone = var.instance.zone
  keys = var.instance.keys
}

resource "ibm_is_instance_volume_attachment" "testacc_att1" {
  count = length(var.data_volumes)
  instance = ibm_is_instance.testacc_instance.id
  name = var.data_volumes[count.index].name
  capacity = var.data_volumes[count.index].capacity
  snapshot = var.data_volumes[count.index].snapshot
  delete_volume_on_attachment_delete = true
  delete_volume_on_instance_delete = true
  volume_name = var.data_volumes[count.index].volume_name
}

volumes_variables:

"data_volumes" : [
        {
            "name" : "test-vol-att-1-45564",
            "capacity" : 50,
            "iops" : 100,
            "volume_name" : "testvol1-45564"
        },
        {
            "name" : "test-vol-att-2-45564",
            "capacity" : 50,
            "iops" : 100,
            "volume_name" : "testvol2-45564"
        }

    ]

Expected Behavior

Creation of all resources

Actual Behavior

module.servers.ibm_is_instance_volume_attachment.testacc_att1[1]: Creation complete after 50s [id=02b7_9edcb278-81ac-4986-9511-ceaceb7d8510/02b7-b858f66a-67f4-42e6-a344-3c4dfde43dc8]

│Error: Error while attaching volume for instance 02b7_9edcb278-81ac-4986-9511-ceaceb7d8510: "User defined volume IOPS is not allowed for storage tier of specified volume profile general-purpose"

│ with module.servers.ibm_is_instance_volume_attachment.testacc_att1[0],
│ on module_vpc_instance\main.tf line 30, in resource "ibm_is_instance_volume_attachment" "testacc_att1":
│ 30: resource "ibm_is_instance_volume_attachment" "testacc_att1" {

The problem with this output (apart from the fact that the IOPS and Capacity value inputted is valid for web UI) is that testacc_att1[0] has the same IOPS and capacity value as testacc_att1[1], yet testacc_att1[1] has been created without problem

Furthermore, using terraform apply again easily creates the failed testacc_att1[0] without any issue. Different executions sometimes make testacc_att1[1] fail after testacc_att1[0] creation, and the error usually happens when one finishes creating(both begin creating at the same time).


Also, when deleting all the created resources (terraform destroy), testacc_att1[1] is very easy to destroy, but testacc_att1[0] timeouts (the opposite happens when testacc_att1[1] fails to create) and gets destroyed along all other resources after using terraform destroy again

Debug Output

This log file has been created using terraform apply two times:

  • The first shows the issue

  • The second allows the creation of the missing resource that could not be created with the first terraform apply due to the issue. For some reason, in the second terraform apply the error does not happen.

https://gist.github.com/jjordana27/bba305b96698119e9fde29a0156fbece


This log file has been created using terraform destroy two times:

  • In the first testacc_att1[1] gets destroyed and testacc_att1[0] timeouts
  • In the second the rest of the resources (including testacc_att1[0]) get deleted

https://gist.github.com/jjordana27/0944dcc5f4be0a546b502d5b1f585325

@astha-jain
Copy link
Contributor

@ujjwal-ibm Could you please check?

@kavya498 kavya498 added the service/VPC Infrastructure Issues related to the VPC Infrastructure label Sep 8, 2021
@ujjwal-ibm
Copy link
Collaborator

@jjordana27 try adding profile = "custom" , which should resolve the issue.

@jjordana27
Copy link
Author

Thank you ! Adding profile = "custom" to ibm_is_instance_volume_attachment solves part of the problem: it no longer shows the error and with one terraform apply I can create all the resources without problem. However, the issue with destroying the attachments still exists.
This time, when using terraform destroy, testacc_att1[0] gets deleted but testacc_att1[1] timeouts (sometimes the reverse happens) . I still need another terraform destroy to eliminate all other resources along with testacc_att1[1].

Terraform Configuration Files

Same input variables, I only added profile argument to configuration

resource "ibm_is_instance_volume_attachment" "testacc_att1" {
  count = length(var.data_volumes)
  instance = ibm_is_instance.testacc_instance.id
  name = var.data_volumes[count.index].name
  profile = "custom"
  capacity = var.data_volumes[count.index].capacity
  delete_volume_on_attachment_delete = true
  delete_volume_on_instance_delete = true
  volume_name = var.data_volumes[count.index].volume_name
}

Debug Output

This log file has been created using

  1. Terraform apply, which creates all resources
  2. Terraform destroy, which destroys testacc_att1[0] but timeouts with testacc_att1[1]
  3. Terraform destroy, which destroys the remaining resources (along with testacc_att1[1])

logfile (I also added the cmd output): https://gist.github.com/jjordana27/094766b675e687b35cc89ff55de1595e

@ujjwal-ibm
Copy link
Collaborator

@jjordana27 seems like an intermittent issue with multiple volume attachments. We're looking into it.

@kavya498
Copy link
Collaborator

kavya498 commented Oct 6, 2021

Available in 1.33.0
Closing this issue thanks!

@kavya498 kavya498 closed this as completed Oct 6, 2021
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

Successfully merging a pull request may close this issue.

4 participants