vmware / terraform-provider-vcd

Terraform VMware Cloud Director provider
https://www.terraform.io/docs/providers/vcd/
Mozilla Public License 2.0
151 stars 112 forks source link

terraform apply returns error 500 if ip_allocation_mode not specified, however plan works fine. #1205

Closed zeol closed 2 months ago

zeol commented 9 months ago

Terraform Version

Terraform v1.4.7 on linux_amd64

Affected Resource(s)

Terraform Configuration Files

resource "vcd_vapp_vm" "vm" {
  count = var.vm_count
  vapp_name = "${var.env}-vm"
  name      = "${var.env}-${count.index}"
  vapp_template_id = data.vcd_catalog_vapp_template.template.id
  memory = 4096
  cpus = 4
  cpu_cores = 4

 dynamic "network" {
  for_each = values(var.vlan_names)
  content {
    type = "org"
    name = data.vcd_network_direct.hrs-vlan.name
    #ip_allocation_mode = "MANUAL"
    ip = network.value[count.index]
  }
 }

}

Debug Output

https://gist.github.com/zeol/a6e532dd0e72f4e01a453048f7fb1c99

Expected Behavior

Plan should fail, with some descriptive error

Actual Behavior

API returned 500

│ Error: error creating VM from template: [VM creation] error getting VM : error instantiating a new VM: API Error: 500: [ f5956605-ac3b-4540-8fa2-665489c2ad86 ] Unable to perform this action. Contact your cloud administrator.

Steps to Reproduce

try to create a resource vcd_vapp_vm with network and ip assigned, but no ip_allocation_mode (as in the code above)

User Access rights

Organization administrator