terraform-provider-vcd: Creating a VM with several disk with terraform vcd but I always get the same error that is rather odd.

Hello, I have a problem when creating several VMs from a template and adding several disks to that VM. When I run it the first time I get this error. when I run Terraform apply again it works. If I destroy it and run Terraform apply again, I get the same error.

Terraform Version

Terraform v1.2.6 on windows_amd64

  • provider registry.terraform.io/vmware/vcd v3.8.0

Affected Resource(s)

Please list the resources as a list, for example:

  • vcd_vapp_vm

Terraform Configuration Files

resource "vcd_vapp_vm" "this" {
  count = var.nr_of_vms
  vapp_name = vcd_vapp.this.name
  name =  "${var.vm_name}${count.index+1}" 
  
  vapp_template_id = data.vcd_catalog_vapp_template.redhat.id
  
  computer_name = "${var.vm_name}${count.index+1}" 
  memory = 4096
  cpus = 2
  cpu_cores = 1

  # Map the network from the data source to the VM
  network {
      name = var.network_name 
      type = "org"
      ip_allocation_mode = "POOL"
      #is_primary = true
  }

 # TODO: change before prod
  customization {
    force                      = true
    auto_generate_password     = false
    admin_password             = "admin"
    # Other customization options to override the ones from template
  }

   depends_on = [vcd_vapp.this]
 }

resource "vcd_vm_internal_disk" "vm1" {
  count = var.nr_of_vms
  vapp_name       = vcd_vapp.this.name
  vm_name         = vcd_vapp_vm.this[0].name
  bus_type        = "paravirtual"
  size_in_mb      = "4096"
  bus_number      = 0
  unit_number     = count.index+1
  #storage_profile = "FC-3PAR-DS-HE"
  allow_vm_reboot = true
  depends_on      = ["vcd_vapp_vm.this"]

}

Debug Output

Please provide a link to GitHub Gist(s) containing complete debug output. You can enable debug by using the commands below:


│ Error: error setting VM CPU/Memory HotAdd capabilities: error updating VM capabilities section: API Error: 400: [ 335809e7-c4bf-47a2-98bc-6895dd93ef03 ] The entity Ref: com.vmware.vcloud.entity.vm:e1c04e33-3781-45a2-938b-71a19bccbb23 is busy completing an operation VAPP_DEPLOY.
│
│   with vcd_vapp_vm.this[2],
│   on main.tf line 62, in resource "vcd_vapp_vm" "this":
│   62: resource "vcd_vapp_vm" "this" {
│   

Expected Behavior

“Apply complete! Resources:…”

Actual Behavior

Error with busy completing an operation VAPP_DEPLOY

Steps to Reproduce

I guess you will need my template. Not sure how to add this

  1. terraform apply

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 1
  • Comments: 19

Most upvoted comments

Ok. I will have to investigate it, looks like some lock is missing somewhere