When deploy machine with extra disk using Terraform, the additional disks are not attached to the VM in VMware Aria Automation UI
search cancel

When deploy machine with extra disk using Terraform, the additional disks are not attached to the VM in VMware Aria Automation UI

book

Article ID: 443434

calendar_today

Updated On:

Products

VCF Automation

Issue/Introduction

When you deploy a virtual machine using Terraform, you may observe that additional disks are not visible in the UI and remain stuck in an "Attaching" state indefinitely. Conversely, when deploying a machine with a similar setup using the VCFA GUI, the volumes are seen correctly.

This is a cosmetic UI issue; the underlying disk is actually attached. You can confirm the volume is functioning by running the following command:

kubectl get vm <vm-name> -n <namespace> -o jsonpath='{.status.volumes}'

If the output displays attached: true, the volume is successfully attached and fine.

Environment

VMware Aria Automation

Cause

This issue occurs when the name and claimName strings within the Terraform VM specification (spec.volumes) are not identical.

The UI fails to correctly parse the attachment state due to this mismatch, causing it to display "Attaching" forever.

Resolution

Resolution Engineering is currently working on a permanent fix for this behavior. Please refer to the workaround provided below.

Workaround: To resolve the UI display issue, you must ensure that the name and claimName are exactly identical for every disk entry in your Terraform VM specification.

  1. Update your Terraform configuration so that the name and claimName match:

Terraform
 
volumes = [
  {
    name = "web-vm-01-data"                    # Must match claimName
    persistentVolumeClaim = {
      claimName = "web-vm-01-data"             # Must match name
    }
  }
]
  1. For new virtual machines, run terraform apply. The UI will now correctly display the status as "Attached".

  2. For existing virtual machines, the disks are already working. If you want the label corrected in the UI immediately, you can recreate the VM Custom Resource (CR). PersistentVolumeClaims (PVCs) will be preserved during this process.

Additional Information

Example Terraform SPEC:

apiVersion: vmoperator.vmware.com/v1alpha3
kind: VirtualMachine
metadata:
  annotations:
spec:
  biosUUID: UUID
  bootstrap:
    sysprep:
      sysprep:
  className: best-effort-small
  image:
    kind: ClusterVirtualMachineImage
    name: vmi-aaaaaaaa
  imageName: imageName
  instanceUUID: UUID
  network:
    interfaces:
      - addresses:
          - XX.XX.XX.XX/24
        name: eth0
        network:
          kind: SubnetSet
          name: networName
  powerOffMode: TrySoft
  powerState: PoweredOn
  restartMode: TrySoft
  storageClass: storageClassA
  suspendMode: TrySoft
  volumes:
    - name: disk1
      persistentVolumeClaim:
        claimName: XXXXX-disk1
    - name: disk2
      persistentVolumeClaim:
        claimName: XXXXX-disk2