IBM-Cloud / terraform-provider-ibm

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

ibm_is_volume capacity volume update failing #2668

Closed VidyasagarMSC closed 2 years ago

VidyasagarMSC commented 3 years ago

Community Note

Terraform CLI and Terraform IBM Provider Version

terraform -v
Terraform v0.15.3
on darwin_amd64
+ provider registry.terraform.io/ibm-cloud/ibm v1.25.0

Affected Resource(s)

Expected Behavior

Should resize the volume without any error. This works fine in UI.

Actual Behavior

Steps to Reproduce

resource "ibm_is_volume" "dedicated_volume" {
  name           = "${var.basename}-volume"
  profile        = "10iops-tier"
  zone           = "${var.region}-1"
  resource_group = var.resource_group_id
  capacity       = var.resize_dedicated_instance_volume ? 250 : 100
  encryption_key = var.keyprotect_key_id
  depends_on = [ibm_iam_authorization_policy.dedicated_volume_policy]
}

// Provision instance in a dedicated host
resource "ibm_is_instance" "dedicated_instance" {
  name    = "${var.basename}-dedicated-instance"
  image   = data.ibm_is_image.image.id
  profile = var.resize_dedicated_instance ? "cx2-8x16" : "cx2-2x4"

  primary_network_interface {
    subnet          = ibm_is_subnet.dedicated_subnet.id
    security_groups = [ibm_is_security_group.dedicated_security_group.id]
  }
  dedicated_host     = ibm_is_dedicated_host.dedicated_host.id
  vpc                = ibm_is_vpc.dedicated_vpc.id
  zone               = "${var.region}-1"
  keys               = local.ssh_key_ids
  resource_group     = var.resource_group_id
  volumes            = [ibm_is_volume.dedicated_volume.id]
  auto_delete_volume = true
}
  1. terraform apply - An instance with attached volume is provisioned on a dedicated host
  2. Set the resize_dedicated_instance_volume to true to increase the volume capacity from the default 100 GB to 250 GB.
  3. terraform apply

fails with

module.create_dedicated[0].ibm_is_volume.dedicated_volume: Destroying... [id=r006-86bc3c77-b4a4-4483-8824-662fb99ddb0c]
╷
│ Error: Error Deleting Volume : The volume is still attached to an instance.
│ {
│     "StatusCode": 409,
│     "Headers": {
│         "Cache-Control": [
│             "max-age=0, no-cache, no-store, must-revalidate"
│         ],
│         "Cf-Cache-Status": [
│             "DYNAMIC"
│         ],
│         "Cf-Ray": [
│             "654469ea8e774ae1-HYD"
│         ],
│         "Cf-Request-Id": [
│             "0a3ea0869500004ae14f2e1000000001"
│         ],
│         "Content-Length": [
│             "240"
│         ],
│         "Content-Type": [
│             "application/json; charset=utf-8"
│         ],
│         "Date": [
│             "Mon, 24 May 2021 06:19:44 GMT"
│         ],
│         "Expect-Ct": [
│             "max-age=604800, report-uri=\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\""
│         ],
│         "Expires": [
│             "-1"
│         ],
│         "Pragma": [
│             "no-cache"
│         ],
│         "Server": [
│             "cloudflare"
│         ],
│         "Strict-Transport-Security": [
│             "max-age=31536000; includeSubDomains"
│         ],
│         "Transaction-Id": [
│             "ca35094c142783f2f7ec1a36cf37a964"
│         ],
│         "Vary": [
│             "Accept-Encoding"
│         ],
│         "X-Content-Type-Options": [
│             "nosniff"
│         ],
│         "X-Request-Id": [
│             "ca35094c142783f2f7ec1a36cf37a964"
│         ],
│         "X-Xss-Protection": [
│             "1; mode=block"
│         ]
│     },
│     "Result": {
│         "errors": [
│             {
│                 "code": "volume_still_attached",
│                 "message": "The volume is still attached to an instance.",
│                 "more_info": "http://www.bluemix.com/help#volume_still_attached",
│                 "target": {
│                     "name": "",
│                     "type": ""
│                 }
│             }
│         ],
│         "trace": "ca35094c142783f2f7ec1a36cf37a964"
│     },
│     "RawResult": null
│ }

Important Factoids

References

astha-jain commented 3 years ago

Resizing a volume is still in a Beta release. We'll keep this request open.

VidyasagarMSC commented 3 years ago

@astha-jain Expandable volume is now GAed.

astha-jain commented 3 years ago

Yes @VidyasagarMSC. Working on getting the provider out.

astha-jain commented 2 years ago

@kavya498 PR is merged This issue can be closed now.

kavya498 commented 2 years ago

Thanks.. closing this issue..