nutanix / terraform-provider-nutanix

Terraform Nutanix Provider
https://www.terraform.io/docs/providers/nutanix/
Mozilla Public License 2.0
95 stars 111 forks source link

Plugin crash for Nutanix Provider due to integer out of range error #589

Open colcove opened 1 year ago

colcove commented 1 year ago

Nutanix Cluster Information

Terraform Version

v1.4.6

Affected Resource(s)

data "nutanix_cluster" "cluster" { name = var.cluster_name } data "nutanix_subnet" "subnet" { subnet_name = var.subnet_name }

provider "nutanix" { username = var.user password = var.password endpoint = var.endpoint insecure = true wait_timeout = 60 }

resource "nutanix_image" "image" { name = "Arch Linux" description = "Arch-Linux-x86_64-basic-20210401.18564" source_uri = "https://mirror.pkgbuild.com/images/latest/Arch-Linux-x86_64-basic-20230415.143207.qcow2" }

resource "nutanix_virtual_machine" "vm" { name = "MyVM from the Terraform Nutanix Provider" cluster_uuid = data.nutanix_cluster.cluster.id num_vcpus_per_socket = "2" num_sockets = "1" memory_size_mib = 1024

disk_list { data_source_reference = { kind = "image" uuid = nutanix_image.image.id } }

disk_list { disk_size_bytes = 10 1024 1024 * 1024 device_properties { device_type = "DISK" disk_address = { "adapter_type" = "SCSI" "device_index" = "1" } } } nic_list { subnet_uuid = data.nutanix_subnet.subnet.id } }


### Debug Output
<!---
Please provide a link to a GitHub Gist containing the complete debug output. Please do NOT paste the debug output in the issue; just paste a link to the Gist.
To obtain the debug output, see the [Terraform documentation on debugging](https://www.terraform.io/docs/internals/debugging.html).
--->
https://gist.github.com/colcove/8d01a5a61c2a7425b14c2d4ef151cc72
### Panic Output
<!--- If Terraform produced a panic, please provide a link to a GitHub Gist containing the output of the `crash.log`. --->
### Expected Behavior
<!--- What should have happened? --->
`terraform plan` should have showed which resources are to be created, in this case 2 resources (1 image, 1 vm).
### Actual Behavior
<!--- What actually happened? --->
`terraform plan` failed and the plugin crashed, due to a value out of range error
### Steps to Reproduce
<!--- Please list the steps required to reproduce the issue. --->
1. `terraform plan`
### Important Factors

Environment: Using Windows 11, Nutanix Provider 1.8.1
**​Workaround found:** 
The issue is with the "disk_size_bytes" variable. I changed this line to be - `disk_size_mib = 10 * 1024` and then ran `terraform plan` again. This time it was successful.

### References
<!---
Information about referencing Github Issues: https://help.github.com/articles/basic-writing-and-formatting-syntax/#referencing-issues-and-pull-requests
Are there any other GitHub issues (open or closed) or pull requests that should be linked here? Vendor documentation? For example:
--->