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.
VMware Aria Automation
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 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.
Update your Terraform configuration so that the name and claimName match:
volumes = [
{
name = "web-vm-01-data" # Must match claimName
persistentVolumeClaim = {
claimName = "web-vm-01-data" # Must match name
}
}
]
For new virtual machines, run terraform apply. The UI will now correctly display the status as "Attached".
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.
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