-
Notifications
You must be signed in to change notification settings - Fork 123
Description
Nutanix Cluster Information
ncc-5.1.1
Terraform Version
Terraform v1.12.0
on linux_amd64
- provider registry.terraform.io/nutanix/nutanix v2.2.0
Affected Resource(s)
nutanix_volume_group_disk_v2
Terraform Configuration Files
The nutanix_volume_group_disk_v2 is the resource that contains the error, specifically disk_size_bytes = each.value.size * 1024 * 1024 * 1024
resource "nutanix_volume_group_disk_v2" "disks" {
for_each = merge([
for vm in var.virtualmachine : {
for idx, disk in vm.additional_disks :
"${vm.hostname}-${idx}" => {
hostname = vm.hostname
idx = idx
size = disk[1]
}
if vm.hypervisor == "ahv" && length(vm.additional_disks) > 0
}
]...)
volume_group_ext_id = resource.nutanix_volume_group_v2.volume_groups[each.value.hostname].ext_id
disk_size_bytes = each.value.size * 1024 * 1024 * 1024
disk_data_source_reference {
name = "disk${each.value.idx+1}"
ext_id = data.nutanix_storage_containers_v2.sg[each.value.hostname].storage_containers[0].ext_id
entity_type = "STORAGE_CONTAINER"
}
lifecycle {
ignore_changes = [
disk_data_source_reference
]
}
}
Used in combination with
data "nutanix_storage_containers_v2" "sg" {
for_each = { for vm in var.virtualmachine : vm.hostname => vm
if vm.hypervisor == "ahv"
}
filter = "clusterExtId eq '${data.nutanix_cluster.cluster[each.value.hostname].cluster_id}'"
limit = 1
}
resource "nutanix_volume_group_v2" "volume_groups" {
for_each = { for vm in var.virtualmachine : vm.hostname => vm
if vm.hypervisor == "ahv"
}
depends_on = [ resource.nutanix_virtual_machine.vm ]
name = "${each.value.hostname}-disk"
description = "Volume group for ${each.value.hostname}"
cluster_reference = data.nutanix_cluster.cluster[each.value.hostname].cluster_id
}
resource "nutanix_volume_group_vm_v2" "attach_disk" {
for_each = { for vm in var.virtualmachine : vm.hostname => vm if vm.hypervisor == "ahv" }
depends_on = [ resource.nutanix_volume_group_vm_v2.attach_disk ]
volume_group_ext_id = nutanix_volume_group_v2.volume_groups[each.key].id
vm_ext_id = nutanix_virtual_machine.vm[each.key].id
index = 1
}
Debug Output
https://gist.github.com/kvandenhoute/c9609d07d6e40c0bc897ed0d063a10e7
Panic Output
Included in debug output
Expected Behavior
The plan itself works, the first and consecutive applies work too. Only, when increasing the disk_size_bytes (in my case increasing each.value.size variable from 7 to 8), the provider panics. This makes it impossible to increase disk size using terraform.
Actual Behavior
Disk size does not change, terraform apply crashes
Steps to Reproduce
Create a nutanix_volume_group_v2, a nutanix_volume_group_vm_v2, nutanix_virtual_machine, a nutanix_volume_group_vm_v2 and a nutanix_volume_group_disk_v2. Do a first apply everything is created. Without changing anything else, increase the disk_size_bytes of the nutanix_volume_group_disk_v2.
- Update disk_size_bytes
terraform apply
Important Factors
Using Prism Central