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

Prevent null reference when reading boot_diagnostics settings. #10283

Merged
merged 1 commit into from
Nov 22, 2016

Conversation

rrudduck
Copy link
Contributor

I ran into this scenario on a few virtual machines. The rest response contained this:

2016/11/21 22:12:40 [DEBUG] plugin: terraform.exe: "diagnosticsProfile": {
2016/11/21 22:12:40 [DEBUG] plugin: terraform.exe: "bootDiagnostics": {
2016/11/21 22:12:40 [DEBUG] plugin: terraform.exe: "enabled": false
2016/11/21 22:12:40 [DEBUG] plugin: terraform.exe: }
2016/11/21 22:12:40 [DEBUG] plugin: terraform.exe: },

Which caused the following panic in 0.7.10 and 0.7.11:

2016/11/21 21:48:10 [DEBUG] plugin: terraform.exe: panic: runtime error: invalid memory address or nil pointer dereference
2016/11/21 21:48:10 [DEBUG] plugin: terraform.exe: [signal 0xc0000005 code=0x0 addr=0x0 pc=0xb1e6cb]
2016/11/21 21:48:10 [DEBUG] plugin: terraform.exe:
2016/11/21 21:48:10 [DEBUG] plugin: terraform.exe: goroutine 3642 [running]:
2016/11/21 21:48:10 [DEBUG] plugin: terraform.exe: panic(0x2a99da0, 0xc04200e090)
2016/11/21 21:48:10 [DEBUG] plugin: terraform.exe: /opt/go/src/runtime/panic.go:500 +0x1af
2016/11/21 21:48:10 [DEBUG] plugin: terraform.exe: github.com/hashicorp/terraform/builtin/providers/azurerm.resourceArmVirtualMachineRead(0xc042e762a0, 0x2cce4e0, 0xc042061a00, 0x0, 0x17)
2016/11/21 21:48:10 [DEBUG] plugin: terraform.exe: /opt/gopath/src/github.com/hashicorp/terraform/builtin/providers/azurerm/resource_arm_virtual_machine.go:613 +0xedb
2016/11/21 21:48:10 [DEBUG] plugin: terraform.exe: github.com/hashicorp/terraform/helper/schema.(*Resource).Refresh(0xc0422fcae0, 0xc042ee20f0, 0x2cce4e0, 0xc042061a00, 0xc0420422b0, 0x1, 0x18)

This fix handles this case by preventing the nil dereference in this case. I'm not sure why only a few VMs experienced the initial issue but this solved it for me.

@kwilczynski
Copy link
Contributor

@rrudduck hi there! Nice catch! Thank you for that!

@stack72
Copy link
Contributor

stack72 commented Nov 22, 2016

Hi @rrudduck

Thanks for the work here - nice guard clause :)

P.

@stack72 stack72 merged commit 9a70b6f into hashicorp:master Nov 22, 2016
gusmat pushed a commit to gusmat/terraform that referenced this pull request Dec 6, 2016
fatmcgav pushed a commit to fatmcgav/terraform that referenced this pull request Feb 27, 2017
@ghost
Copy link

ghost commented Apr 19, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants