opentelekomcloud / terraform-provider-opentelekomcloud

Terraform OpenTelekomCloud provider
https://registry.terraform.io/providers/opentelekomcloud/opentelekomcloud/latest
Mozilla Public License 2.0
87 stars 78 forks source link

EVS volume attach not working correctly #2612

Closed GaborBella closed 1 month ago

GaborBella commented 2 months ago

Terraform provider version

opentelekomcloud/opentelekomcloud v1.36.16

Affected Resource(s)

Terraform Configuration Files

resource "opentelekomcloud_evs_volume_v3" "volume" {
  for_each = var.evs_volumes
  availability_zone = opentelekomcloud_ecs_instance_v1.ecs.availability_zone
  name              = "${opentelekomcloud_ecs_instance_v1.ecs.name}-${each.key}"
  volume_type       = each.value.type
  size              = each.value.size
  backup_id         = each.value.backup_id
  snapshot_id       = each.value.snapshot_id
}

resource "opentelekomcloud_compute_volume_attach_v2" "volume_attach" {
  for_each = var.evs_volumes
  instance_id = opentelekomcloud_ecs_instance_v1.ecs.id
  volume_id   = opentelekomcloud_evs_volume_v3.volume[each.key].id
  device      = each.value.device
}
variable "evs_volumes" {
  type = map(object({
    type        = string
    size        = string
    backup_id   = optional(string)
    snapshot_id = optional(string)
    device      = optional(string)
  }))
  default = {}
  description = "Additional data disks based on EVS and supports size increase."
}

....
  evs_volumes = {
    data3 = {
      type = "SAS"
      size = "25"
      device = "/dev/vdd"
    }
    data = {
      type = "SSD"
      size = "10"
#      device = "/dev/vdc"
    }
    data2 = {
      type = "SSD"
      size = "15"
      device = "/dev/vdb"
    }
  }
...

Debug Output/Panic Output

[WARN] Provider "registry.terraform.io/opentelekomcloud/opentelekomcloud" produced an invalid plan for module.ecs2.opentelekomcloud_compute_volume_attach_v2.volume_attach["data2"], but we are tolerating it because it is using the legacy plugin SDK. The following problems may be the cause of any confusing errors from downstream operations:

Steps to Reproduce

Try to attach an EVS to ECS, with path (device)

Expected Behavior

I expected that it will attached the EVS volume to the proper path to the ECS

Actual Behavior

Randomly attached the EVS disks

artem-lifshits commented 1 month ago

Hello @GaborBella fixed in latest release.