orange-cloudavenue / terraform-provider-cloudavenue

Terraform Cloud Avenue provider
https://registry.terraform.io/providers/orange-cloudavenue/cloudavenue
Mozilla Public License 2.0
15 stars 3 forks source link

[Bug]: VM Disk Creation error #756

Open xriot2 opened 5 months ago

xriot2 commented 5 months ago

Terraform Core Version

v1.7.4

Cloud Avenue Provider Version

0.18.4

Affected Resource(s)

CloudAvenue Disk

Expected Behavior

SCSI Disk creation (attached disk)

Actual Behavior

error during the creation:

cloudavenue_vm.res_vm[0]: Still creating... [2m10s elapsed]
cloudavenue_vm.res_vm[0]: Creation complete after 2m13s [id=urn:vcloud:vm:a571b842-388d-49a1-9688-505ba1e0f515]
cloudavenue_vm_disk.disk[0]: Creating...
cloudavenue_vm_disk.disk[0]: Still creating... [10s elapsed]
cloudavenue_vm_disk.disk[0]: Still creating... [20s elapsed]
╷
│ Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to cloudavenue_vm_disk.disk[0], provider
│ "provider[\"registry.terraform.io/orange-cloudavenue/cloudavenue\"]"
│ produced an unexpected new value: .bus_type: was cty.StringVal("SCSI"), but
│ now cty.StringVal("SATA").
│ 
│ This is a bug in the provider, which should be reported in the provider's
│ own issue tracker.
╵
Uploading artifacts for failed job

Relevant Error/Panic Output Snippet

No response

Terraform Configuration Files

resource "cloudavenue_vm_disk" "disk" {

  depends_on = [cloudavenue_vm.res_vm]

  count           = var.vm_config.count

  size_in_mb      = var.disk_config.disk_size_in_gb * 1024
  bus_type        = var.disk_config.bus_type
  bus_number      = var.disk_config.bus_number
  is_detachable   = var.disk_config.disk_is_detachable
  name            = var.disk_config.disk_is_detachable ? "${local.disk_name_prefix}${format("%02d", count.index)}" : null
  storage_profile = var.disk_config.storage_profile
  unit_number     = var.disk_config.unit_number
  vapp_id         = null
  vapp_name       = try(cloudavenue_vm.res_vm[count.index].vapp_name, null)
  vm_id           = null
  vm_name         = try(cloudavenue_vm.res_vm[count.index].name, null)
}

with variables

disk_config = {
    bus_type = "SCSI"
    bus_number = 0
    unit_number = 1
    disk_is_detachable = false
    storage_profile = "silver"
    disk_size_in_gb = 10
    disk_mount_point = "/var/lib/vital"
}

Steps to Reproduce

just request a creation of vm with an attached disk with SCSI bus

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

None

azrod commented 5 months ago

Hello

Please add terraform configuration for cloudavenue_vm resource

Thanks

xriot2 commented 5 months ago

vm ressource is defined by

// VM
resource "cloudavenue_vm" "res_vm" {

  depends_on = [cloudavenue_vapp.vapp]

  count    = var.vm_config.count

  name     = "${local.vm_name_prefix}${format("%02d", count.index)}"
  description = var.vm_config.description

  vapp_name = cloudavenue_vapp.vapp.name
  vapp_id = null

  deploy_os = {
    vapp_template_id = data.cloudavenue_catalog_vapp_template.template.id
  }

  resource = {
    cpu_hot_add_enabled    = true
    cpus                   = var.vm_config.cpu
    cpus_cores             = var.vm_config.cpu_cores
    memory                 = var.vm_config.memory_in_gb * 1024
    memory_hot_add_enabled = true
    networks               = [
        {
          type = "org"
          adapter_type = "VMXNET3"
          ip_allocation_mode = "POOL"
          connected = true
          name = var.vm_config.networknames[0]
          is_primary = true
        }
      ]
  }

  settings = {
    affinity_rule_id               = null
    expose_hardware_virtualization = var.vm_config.expose_hardware_virtualization
    guest_properties               = {}
    os_type                        = var.vm_config.os_type
    storage_profile                = var.disk_config.storage_profile
    customization = {
      admin_password                      = var.vm_config.admin_password
      allow_local_admin_password          = var.vm_config.allow_local_admin_password
      # comment below if allow_local_admin_password is set
      #auto_generate_password              = false
      change_sid                          = false
      enabled                             = var.vm_config.enabled_guest_config
      force                               = var.vm_config.reboot
      hostname                            = "${local.vm_name_prefix}${format("%02d", count.index)}"
      init_script                         = local.vm_init_script
      join_domain                         = false
      join_domain_account_ou              = null
      join_domain_name                    = null
      join_domain_password                = null
      join_domain_user                    = null
      join_org_domain                     = false
      must_change_password_on_first_login = false
      number_of_auto_logons               = null
    }
  }

  state = {
    power_on = true
  }
}

with variables

# vm definition
vm_config = {
      description  = "Antivirus engine"
      catalog_name = "Orange-Linux-Internal"
      os           = "OBSMASTER_UBUNTU_22.04"
      os_type      = "ubuntu64Guest"
      count        = 1
      expose_hardware_virtualization = true
      cpu          = 4
      cpu_cores    = 1
      memory_in_gb = 8
      networknames = [ "obsitlabiaas" ]
      admin_password = "XXXXXXX"
      allow_local_admin_password = true
      enabled_guest_config       = true
      # after each vm update, reboot the server
      reboot = true
}
xriot2 commented 4 months ago

Hi, any news about this problem ? best regards

azrod commented 4 months ago

Hi @xriot2,

Please try to create disk with parameters :

disk_config = {
    bus_type = "SCSI"
    bus_number = 2
    unit_number = 0
    disk_is_detachable = false
    storage_profile = "silver"
    disk_size_in_gb = 10
    disk_mount_point = "/var/lib/vital"
}
xriot2 commented 4 months ago

It's the same behaviour with the configuration:

disk_config = {
    bus_type = "SCSI"
    bus_number = 2
    unit_number = 0
    disk_is_detachable = false
    storage_profile = "silver"
    disk_size_in_gb = 10
    disk_mount_point = "/var/lib/vital"
}
cloudavenue_vm.res_vm[0]: Creation complete after 3m35s [id=urn:vcloud:vm:eb438227-a417-4584-b3c4-189b2287689b]
cloudavenue_vm_disk.disk[0]: Creating...
cloudavenue_vm_disk.disk[0]: Still creating... [10s elapsed]
cloudavenue_vm_disk.disk[0]: Still creating... [20s elapsed]
cloudavenue_vm_disk.disk[0]: Still creating... [30s elapsed]
╷
│ Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to cloudavenue_vm_disk.disk[0], provider
│ "provider[\"registry.terraform.io/orange-cloudavenue/cloudavenue\"]"
│ produced an unexpected new value: .bus_type: was cty.StringVal("SCSI"), but
│ now cty.StringVal("SATA").
│ 
│ This is a bug in the provider, which should be reported in the provider's
│ own issue tracker.
╵
xriot2 commented 4 months ago

Hi, any news about this problem because we are blocked since a long time ? best regards

azrod commented 2 months ago

Hi,

Sorry for the delay in response.

The problem does not seem to come from the terraform provider.

When you define "SCSI" what is the value actually defined on the IHM ?

Regards

xriot2 commented 1 month ago

into the GUI, it indicates 'SATA' and not 'SCSI'