hashicorp / terraform-provider-vsphere

Terraform Provider for VMware vSphere
https://registry.terraform.io/providers/hashicorp/vsphere/
Mozilla Public License 2.0
612 stars 449 forks source link

Terraform panic: runtime error: index out of range #56

Closed hashibot closed 7 years ago

hashibot commented 7 years ago

This issue was originally opened by @Dinomoe as hashicorp/terraform#9495. It was migrated here as part of the provider split. The original body of the issue is below.


Hello Newb Here,

When running a terraform plan I receive a !!! TERRAFORM CRASH !!!

Troubleshooting:

  1. Upgraded to most recent version
  2. Restarted host
  3. It appears if I remove the terraform.tfsate file I can successfully run terraform plan

Original version Terraform v0.7.3 Upgraded to Terraform v0.7.7

2016/10/20 14:47:36 [DEBUG] plugin: terraform: panic: runtime error: index out of range
2016/10/20 14:47:36 [DEBUG] plugin: terraform:
2016/10/20 14:47:36 [DEBUG] plugin: terraform: goroutine 45 [running]:
2016/10/20 14:47:36 [DEBUG] plugin: terraform: panic(0x28c59c0, 0xc42000e0c0)
2016/10/20 14:47:36 [DEBUG] plugin: terraform:  /opt/go/src/runtime/panic.go:500 +0x1a1
less crash.log |grep ERROR
2016/10/20 13:55:31 [ERROR] root.vsphere-dc: eval: *terraform.EvalRefresh, err: vsphere_virtual_machine.mi-edge-nodes: unexpected EOF
2016/10/20 13:55:31 [ERROR] root.vsphere-dc: eval: *terraform.EvalSequence, err: vsphere_virtual_machine.mi-edge-nodes: unexpected EOF
2016/10/20 13:55:31 [ERROR] root.vsphere-dc: eval: *terraform.EvalOpFilter, err: vsphere_virtual_machine.mi-edge-nodes: unexpected EOF
2016/10/20 13:55:31 [ERROR] root.vsphere-dc: eval: *terraform.EvalSequence, err: vsphere_virtual_machine.mi-edge-nodes: unexpected EOF
2016/10/20 13:55:31 [ERROR] root.vsphere-dc: eval: *terraform.EvalRefresh, err: vsphere_virtual_machine.mi-control-nodes: unexpected EOF
2016/10/20 13:55:31 [ERROR] root.vsphere-dc: eval: *terraform.EvalSequence, err: vsphere_virtual_machine.mi-control-nodes: unexpected EOF
2016/10/20 13:55:31 [ERROR] root.vsphere-dc: eval: *terraform.EvalOpFilter, err: vsphere_virtual_machine.mi-control-nodes: unexpected EOF
2016/10/20 13:55:31 [ERROR] root.vsphere-dc: eval: *terraform.EvalSequence, err: vsphere_virtual_machine.mi-control-nodes: unexpected EOF
2016/10/20 13:55:31 [ERROR] root.vsphere-dc: eval: *terraform.EvalRefresh, err: vsphere_virtual_machine.mi-worker-nodes.0: unexpected EOF
2016/10/20 13:55:31 [ERROR] root.vsphere-dc: eval: *terraform.EvalSequence, err: vsphere_virtual_machine.mi-worker-nodes.0: unexpected EOF
2016/10/20 13:55:31 [ERROR] root.vsphere-dc: eval: *terraform.EvalOpFilter, err: vsphere_virtual_machine.mi-worker-nodes.0: unexpected EOF
2016/10/20 13:55:31 [ERROR] root.vsphere-dc: eval: *terraform.EvalSequence, err: vsphere_virtual_machine.mi-worker-nodes.0: unexpected EOF
2016/10/20 13:55:31 [ERROR] root.vsphere-dc: eval: *terraform.EvalRefresh, err: vsphere_virtual_machine.mi-kubeworker-nodes: unexpected EOF
2016/10/20 13:55:31 [ERROR] root.vsphere-dc: eval: *terraform.EvalSequence, err: vsphere_virtual_machine.mi-kubeworker-nodes: unexpected EOF
2016/10/20 13:55:31 [ERROR] root.vsphere-dc: eval: *terraform.EvalOpFilter, err: vsphere_virtual_machine.mi-kubeworker-nodes: unexpected EOF
2016/10/20 13:55:31 [ERROR] root.vsphere-dc: eval: *terraform.EvalSequence, err: vsphere_virtual_machine.mi-kubeworker-nodes: unexpected EOF

Deploying to vSphere Resources vsphere_virtual_machine.mi-edge-nodes vsphere_virtual_machine.mi-control-nodes vsphere_virtual_machine.mi-worker-nodes vsphere_virtual_machine.mi-kubeworker-nodes

Terraform Configuration Files

vsphere.tf https://gist.github.com/Dinomoe/73c7d70abb6127e81f773aa47c17a916

main.tf https://gist.github.com/Dinomoe/16916ec517d67913a682e3d1124e7a2d

Debug Output

https://gist.github.com/Dinomoe/0d793c170525917eb6c8df8d5137e0ce

Panic Output

https://gist.github.com/Dinomoe/118221eb94fe3bb4180015e418772240

terraform.tfstate Output

https://gist.github.com/Dinomoe/b345aca90047c68805496263a019c166

Expected Behavior

What should have happened? Terraform Plan output expected.

Actual Behavior

What actually happened? Terraform Crash

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform plan
bamb00 commented 7 years ago

Looks like this issue was open in October 2016. Will this issue be address? Is there a workaround?

vancluever commented 7 years ago

Hello!

Looking at the crash logs, and judging from the nature of the issue, I think this should be fixed now that #129 has been merged. If there is anyone watching this issue that has the capabilities to build a custom provider binary can give it a go, that'd be great.

If course, if this does not fix this issue specifically, please open a new issue and reference this one.

Thanks again and sorry for the delays!

Mihai-CMM commented 6 years ago

Hi guys, This is yet not fixed in 11.2 with Openstack provider crash.log

panic: runtime error: index out of range 2018-01-25T15:24:28.251+0200 [DEBUG] plugin.terraform-provider-openstack_v1.2.0_x4: 2018-01-25T15:24:28.251+0200 [DEBUG] plugin.terraform-provider-openstack_v1.2.0_x4: goroutine 574 [running]: 2018-01-25T15:24:28.251+0200 [DEBUG] plugin.terraform-provider-openstack_v1.2.0_x4: github.com/terraform-providers/terraform-provider-openstack/openstack.flattenInstanceNetworks(0xc4201398f0, 0xcd2340, 0xc4205a7b00, 0xbd8f00, 0xc4202e0fb0, 0x0, 0x0, 0x0) 2018-01-25T15:24:28.252+0200 [DEBUG] plugin.terraform-provider-openstack_v1.2.0_x4: /opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-openstack/openstack/compute_instance_v2_networking.go:432 +0x13d7 2018-01-25T15:24:28.252+0200 [DEBUG] plugin.terraform-provider-openstack_v1.2.0_x4: github.com/terraform-providers/terraform-provider-openstack/openstack.resourceComputeInstanceV2Read(0xc4201398f0, 0xcd2340, 0xc4205a7b00, 0x0, 0x0) 2018-01-25T15:24:28.252+0200 [DEBUG] plugin.terraform-provider-openstack_v1.2.0_x4: /opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-openstack/openstack/resource_openstack_compute_instance_v2.go:491 +0x3a0 2018-01-25T15:24:28.252+0200 [DEBUG] plugin.terraform-provider-openstack_v1.2.0_x4: github.com/terraform-providers/terraform-provider-openstack/openstack.resourceComputeInstanceV2Create(0xc4201398f0, 0xcd2340, 0xc4205a7b00, 0x0, 0xc4204c4748) 2018-01-25T15:24:28.252+0200 [DEBUG] plugin.terraform-provider-openstack_v1.2.0_x4: /opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-openstack/openstack/resource_openstack_compute_instance_v2.go:471 +0xf3d 2018-01-25T15:24:28.252+0200 [DEBUG] plugin.terraform-provider-openstack_v1.2.0_x4: github.com/terraform-providers/terraform-provider-openstack/vendor/github.com/hashicorp/terraform/helper/schema.(Resource).Apply(0xc420254840, 0xc420587590, 0xc42031a340, 0xcd2340, 0xc4205a7b00, 0x1, 0xc420278d80, 0xc420278d80) 2018-01-25T15:24:28.252+0200 [DEBUG] plugin.terraform-provider-openstack_v1.2.0_x4: /opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-openstack/vendor/github.com/hashicorp/terraform/helper/schema/resource.go:193 +0x3b6 2018-01-25T15:24:28.253+0200 [DEBUG] plugin.terraform-provider-openstack_v1.2.0_x4: github.com/terraform-providers/terraform-provider-openstack/vendor/github.com/hashicorp/terraform/helper/schema.(Provider).Apply(0xc420138700, 0xc420587540, 0xc420587590, 0xc42031a340, 0x7ffae018d000, 0x0, 0x2b9) 2018-01-25T15:24:28.253+0200 [DEBUG] plugin.terraform-provider-openstack_v1.2.0_x4: /opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-openstack/vendor/github.com/hashicorp/terraform/helper/schema/provider.go:259 +0xa4 2018-01-25T15:24:28.253+0200 [DEBUG] plugin.terraform-provider-openstack_v1.2.0_x4: github.com/terraform-providers/terraform-provider-openstack/vendor/github.com/hashicorp/terraform/plugin.(ResourceProviderServer).Apply(0xc4203aa200, 0xc42031a2a0, 0xc42033ef00, 0x0, 0x0) 2018-01-25T15:24:28.253+0200 [DEBUG] plugin.terraform-provider-openstack_v1.2.0_x4: /opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-openstack/vendor/github.com/hashicorp/terraform/plugin/resource_provider.go:488 +0x57 2018-01-25T15:24:28.253+0200 [DEBUG] plugin.terraform-provider-openstack_v1.2.0_x4: reflect.Value.call(0xc42021b9e0, 0xc42000d160, 0x13, 0xd17f7d, 0x4, 0xc4203f0f20, 0x3, 0x3, 0x0, 0xc42056a380, ...) 2018-01-25T15:24:28.253+0200 [DEBUG] plugin.terraform-provider-openstack_v1.2.0_x4: /usr/local/go/src/reflect/value.go:434 +0x905 2018-01-25T15:24:28.253+0200 [DEBUG] plugin.terraform-provider-openstack_v1.2.0_x4: reflect.Value.Call(0xc42021b9e0, 0xc42000d160, 0x13, 0xc4205a1f20, 0x3, 0x3, 0xc4205a1f20, 0xc4205a1f28, 0xc4204b3580) 2018-01-25T15:24:28.253+0200 [DEBUG] plugin.terraform-provider-openstack_v1.2.0_x4: /usr/local/go/src/reflect/value.go:302 +0xa4 2018-01-25T15:24:28.254+0200 [DEBUG] plugin.terraform-provider-openstack_v1.2.0_x4: net/rpc.(service).call(0xc42046f440, 0xc4204112c0, 0xc420412590, 0xc420070400, 0xc4203aa820, 0xbb75a0, 0xc42031a2a0, 0x16, 0xbb75e0, 0xc42033ef00, ...) 2018-01-25T15:24:28.254+0200 [DEBUG] plugin.terraform-provider-openstack_v1.2.0_x4: /usr/local/go/src/net/rpc/server.go:381 +0x142 2018-01-25T15:24:28.254+0200 [DEBUG] plugin.terraform-provider-openstack_v1.2.0_x4: created by net/rpc.(Server).ServeCodec 2018-01-25T15:24:28.254+0200 [DEBUG] plugin.terraform-provider-openstack_v1.2.0_x4: /usr/local/go/src/net/rpc/server.go:475 +0x36b 2018/01/25 15:24:28 [TRACE] root.gw_pub: eval: terraform.EvalWriteState 2018/01/25 15:24:28 [TRACE] root.gw_pub: eval: terraform.EvalApplyProvisioners 2018/01/25 15:24:28 [TRACE] root.gw_pub: eval: terraform.EvalIf 2018/01/25 15:24:28 [TRACE] root.gw_pub: eval: terraform.EvalWriteState 2018/01/25 15:24:28 [TRACE] root.gw_pub: eval: terraform.EvalWriteDiff 2018/01/25 15:24:28 [TRACE] root.gw_pub: eval: terraform.EvalApplyPost 2018/01/25 15:24:28 [ERROR] root.gw_pub: eval: terraform.EvalApplyPost, err: 1 error(s) occurred:

!!!!!!!!!!!!!!!!!!!!!!!!!!! TERRAFORM CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!

Terraform crashed! This is always indicative of a bug within Terraform. A crash log has been placed at "crash.log" relative to your current working directory. It would be immensely helpful if you could please report the crash with Terraform1 so that we can fix this.

When reporting bugs, please include your terraform version. That information is available on the first line of crash.log. You can also get it by running 'terraform --version' on the command line.

!!!!!!!!!!!!!!!!!!!!!!!!!!! TERRAFORM CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!! crash.log

[root@localhost terraform]# terraform11.2 --version Terraform v0.11.2