Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Virtual Machine v2 and Virtual Machines v2 Data Sources: Correct memorySizeBytes Attribute #743

Closed
wants to merge 4 commits into from

Conversation

akli-ime
Copy link

@akli-ime akli-ime commented Feb 3, 2025

This PR addresses an issue with the memorySizeBytes attribute in both the Virtual Machine v2 and Virtual Machines v2 data sources. The attribute was previously incorrectly fetched. This fix ensures the memorySizeBytes is properly retrieved and correctly handled.

@akli-ime
Copy link
Author

akli-ime commented Feb 11, 2025

The value of memory_size_bytes is equal to zero because the provider is looking for memory_size_bytes (with an underscore), while the Nutanix V4 API returns memorySizeBytes.

Using Nutanix API
curl --location --request GET https://nutanix_server:9440/api/vmm/v4.0/ahv/config/vms?$filter=name eq 'vm name'
Snippet of JSON response :

`
"description": "VSA",

        "numSockets": 1,

        "numCoresPerSocket": 1,

        "numThreadsPerCore": 1,

        "numNumaNodes": 0,

        "memorySizeBytes": 4294967296,

        "isVcpuHardPinningEnabled": false,

        "isCpuPassthroughEnabled": false,

        "isMemoryOvercommitEnabled": false,

`
=> memorySizeBytes": 4294967296

When I use the official provider:

Snippet of JSON response :

`
"is_cpu_passthrough_enabled" = false

  "is_gpu_console_enabled" = false

  "is_memory_overcommit_enabled" = false

  "is_scsi_controller_enabled" = false

  "is_vcpu_hard_pinning_enabled" = false

  "is_vga_console_enabled" = true

  "machine_type" = "PC"

  "memory_size_bytes" = 0

`
=> memory_size_bytes" = 0

When I use the provider including my pull request:

Snippet of JSON response :

` "is_cpu_passthrough_enabled" = false

  "is_gpu_console_enabled" = false

  "is_memory_overcommit_enabled" = false

  "is_scsi_controller_enabled" = false

  "is_vcpu_hard_pinning_enabled" = false

  "is_vga_console_enabled" = true

  "machine_type" = "PC"

  "memorysizebytes" = 4294967296`

=> memorysizebytes" = 4294967296

Regards !

@akli-ime
Copy link
Author

I found the cause of the issue. It was the Terraform version (1.10.0). Updating to version 1.10.5 resolved the problem.
Regards

@akli-ime akli-ime closed this Feb 12, 2025
@akli-ime akli-ime deleted the patch-2 branch February 12, 2025 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant