Skip to content

vApp properties do not apply when set to blank #2616

@rossengeorgiev

Description

@rossengeorgiev

Code of Conduct

  • I have read and agree to the Code of Conduct.
  • Vote on this issue by adding a 👍 reaction to the original issue initial description to help the maintainers prioritize.
  • Do not leave "+1" or other comments that do not add relevant information or questions.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Terraform

1.3.8

Terraform Provider

2.15.0

VMware vSphere

8.0.3

Description

When I attempt to set the vApp properties to blank, nothing happens. The diff always comes as it going to set the blank, but it doesn't actually do it.

Affected Resources or Data Sources

resource/vsphere_virtual_machine

Terraform Configuration

resource "vsphere_virtual_machine" "vm" {
  name                 = "test-vm"
  datacenter_id        = data.vsphere_datacenter.datacenter.id
  datastore_id         = data.vsphere_datastore.datastore.id
  resource_pool_id     = data.vsphere_resource_pool.default.id
  host_system_id       = tolist(data.vsphere_compute_cluster_host_group.host_group.host_system_ids)[0]

  num_cpus = 2
  num_cores_per_socket = 2
  memory = 2048

  wait_for_guest_net_timeout = 5
  wait_for_guest_ip_timeout  = 5

  lifecycle {
    ignore_changes = [ datastore_id, host_system_id ]
  }

  cdrom {
    client_device = true
  }

  # relevant parts
  ovf_deploy {
    remote_ovf_url            = "https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.ova"
    disk_provisioning         = "thin"
  }

  vapp {
    properties = {
      "hostname"    = "mytestvm.local"
      "instance-id" = ""  # <--- issue setting var to blank
    }
  }
}

Debug Output

n/a

Panic Output

No response

Expected Behavior

When I'm setting them to blank I expect for them to be set to blank. This is useful when deploying from template, which already has values set. but I want to reset them on the deployed VM.

It also appears that if the value is set to blank, it gets reset the default value from the OVA, which is not correct behaviour.

Actual Behavior

vApp properties are not set to blank. Value get reset to the default.

Note that its possible to set the value to blank in the vCenter interface.

Image

Steps to Reproduce

  1. Create VM from OVA using terraform
Image
  1. After VM has been deployed, run terraform apply again. The diff shows that instance-id has not been set blank. Keep in mind that the OVA has a default value for that property.
Image

In vCenter UI:

Image
  1. Run terraform apply again, and step (2) will repeat.

Environment Details

No response

Screenshots

No response

References

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/vmArea: Virtual MachinesbugBug

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions