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

'invalid memory address or nil pointer dereference' while getting a VM. #168

Closed
BiGOUDx opened this issue Sep 22, 2020 · 4 comments · Fixed by #169
Closed

'invalid memory address or nil pointer dereference' while getting a VM. #168

BiGOUDx opened this issue Sep 22, 2020 · 4 comments · Fixed by #169

Comments

@BiGOUDx
Copy link

BiGOUDx commented Sep 22, 2020

Nutanix Cluster Information

  • Nutanix Cluster Prism Element : 5.15 LTS
  • Nutanix Prism Central : pc.2020.8.0.1

Terraform Version

Terraform v0.13.3
provider registry.terraform.io/terraform-providers/nutanix v1.1.0

Affected Resource(s)

  • data "nutanix_virtual_machine" "template_win2019"

Terraform Configuration Files

provider "nutanix" {
 username = "admin"
 password = "xxxxxxxxx"
 endpoint = "fqdn prism central"
 insecure = true
}

data "nutanix_virtual_machine" "template_win2019" {
  vm_id = "id of the vm"
}

Debug Output

Panic Output

https://gist.github.com/BiGOUDx/1a5b502c26bfeb6cd04bc31948b6a2b3

Expected Behavior

Get information from my template VM.

Actual Behavior

Terraform crashes. A lot of errors appear.

Steps to Reproduce

  1. terraform plan

Important Factors

I tried:

  • with Prism Element
  • with Prism Central
  • with Terraform 0.12.29

It's working with some VM (other ID). Some don't work.
I cannot understand the common factor.

@yannickstruyf3
Copy link
Collaborator

Hi,

Would it be possible to execute the plan with following command and share the tf.log file?
TF_LOG=trace TF_LOG_PATH=tf.log terraform plan

Please make sure the logs do not contain sensitive information.

@BiGOUDx
Copy link
Author

BiGOUDx commented Sep 24, 2020

yannickstruyf3 added a commit to yannickstruyf3/terraform-provider-nutanix that referenced this issue Sep 24, 2020
@yannickstruyf3
Copy link
Collaborator

Thanks @BiGOUDx for sharing the log.
This seems to be a bug in the provider when a data source is used on a VM that has following boot config:

"boot_config": {
    "boot_device_order_list": [
        "CDROM",
        "DISK",
        "NETWORK"
    ],
    "boot_type": "LEGACY"
},

I created a PR #169 that fixes this issue. Was able to reproduce and fix in my lab environment.

Kind regards

@BiGOUDx
Copy link
Author

BiGOUDx commented Sep 24, 2020

Correct. I changed the boot order and everything is fine now. Thanks for your help and the future fix.

marinsalinas added a commit that referenced this issue Nov 16, 2020
Fix issue #168, unchecked nil assignment
yannickstruyf3 added a commit to yannickstruyf3/terraform-provider-nutanix that referenced this issue Nov 9, 2021
yannickstruyf3 pushed a commit to yannickstruyf3/terraform-provider-nutanix that referenced this issue Nov 9, 2021
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 a pull request may close this issue.

2 participants