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

Error deleting instance with data volume #1412

Closed
js-max opened this issue May 6, 2020 · 2 comments
Closed

Error deleting instance with data volume #1412

js-max opened this issue May 6, 2020 · 2 comments

Comments

@js-max
Copy link

js-max commented May 6, 2020

Terraform Version

$ terraform -v
Terraform v0.12.24
+ provider.ibm v1.5.1

Affected Resource(s)

Please list the resources as a list, for example:

  • ibm_is_instance
  • ibm_is_volume

Terraform Configuration Files

Simple resource declaration

resource "ibm_is_volume" "data-vol-osp-master-01" {
  name           = "data-vol-osp-master-01"
  resource_group = data.ibm_resource_group.rg-test-poc.id
  zone           = "eu-gb-1"

  profile  = "general-purpose"
  capacity = 50
}

resource "ibm_is_volume" "log-vol-osp-master-01" {
  name           = "log-vol-osp-master-01"
  resource_group = data.ibm_resource_group.rg-test-poc.id
  zone           = "eu-gb-1"

  profile  = "general-purpose"
  capacity = 10
}

resource "ibm_is_instance" "osp-master-01" {
  name           = "osp-master-01"
  image          = "r018-6f153a5d-6a9a-496d-8063-5c39932f6ded"
  profile        = "cx2-2x4"
  resource_group = data.ibm_resource_group.rg-test-poc.id

  boot_volume {
    name = "boot-vol-osp-master-01"
  }

  volumes = [
    ibm_is_volume.data-vol-osp-master-01.id,
    ibm_is_volume.log-vol-osp-master-01.id
  ]

  primary_network_interface {
    subnet          = ibm_is_subnet.osp-subnet-vpc-test-poc.id
    security_groups = [ibm_is_security_group.sg-vpc-test-poc.id]
  }

  vpc  = ibm_is_vpc.vpc-test-poc.id
  zone = "eu-gb-1"
}

Debug Output

Error: Error while removing volume "0787-7f70b239-b7a2-4e34-b92a-34d398ee0f13" for instance 0787_563e4151-469d-48c4-b1d1-cc319701cb4b: "Provided volume attachment ID not attached to VSI"

Expected Behavior

When executing terraform destroy instance with data volumes should be deleted

Actual Behavior

When executing terraform destroy instances are not being deleted and terraform exit error

Steps to Reproduce

  1. terraform destroy

Extra info from IBM Cloud shell

After terraform apply

@cloudshell:~$ ibmcloud is instance-volume-attachments 0787_563e4151-469d-48c4-b1d1-cc319701cb4b
Listing volume attachments of instance 0787_563e4151-469d-48c4-b1d1-cc319701cb4b under account ...
ID                                          Name                Volume                   Created                     Status     Type   Auto delete   
0787-6abbd53c-dfb0-42b7-81fd-9af11ebb56ee   volume-attachment   boot-vol-osp-master-01   2020-05-06T17:58:07+00:00   attached   boot   yes   
0787-7f70b239-b7a2-4e34-b92a-34d398ee0f13   volume-attachment   data-vol-osp-master-01   2020-05-06T17:58:40+00:00   attached   data   no   
0787-e95f2a5f-4cac-4c55-b4e3-9facda8b5870   volume-attachment   log-vol-osp-master-01    2020-05-06T17:59:12+00:00   attached   data   no   

After terraform destroy

@cloudshell:~$ ibmcloud is instance-volume-attachments 0787_563e4151-469d-48c4-b1d1-cc319701cb4b
Listing volume attachments of instance 0787_563e4151-469d-48c4-b1d1-cc319701cb4b under account ...
ID                                          Name                Volume                   Created                     Status      Type   Auto delete   
0787-6abbd53c-dfb0-42b7-81fd-9af11ebb56ee   volume-attachment   boot-vol-osp-master-01   2020-05-06T17:58:07+00:00   attaching   boot   yes   
0787-7f70b239-b7a2-4e34-b92a-34d398ee0f13   volume-attachment   data-vol-osp-master-01   2020-05-06T17:58:40+00:00   attaching   data   no   
0787-e95f2a5f-4cac-4c55-b4e3-9facda8b5870   volume-attachment   log-vol-osp-master-01    2020-05-06T17:59:12+00:00   attaching   data   no   
VaishnaviGopal added a commit to VaishnaviGopal/terraform-provider-ibm that referenced this issue May 7, 2020
@hkantare
Copy link
Collaborator

hkantare commented May 8, 2020

@hkantare hkantare reopened this May 8, 2020
@js-max
Copy link
Author

js-max commented May 8, 2020

Confirmed that created and deleted resources (instances plus volumes and attached) successfully.

Thanks.

@js-max js-max closed this as completed May 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants