skytap / terraform-provider-skytap

Terraform Skytap provider
https://www.terraform.io/docs/providers/skytap/
Mozilla Public License 2.0
4 stars 11 forks source link

Adding a VM attached to a manual network from a Template to an existing environment causes Terraform to crash #29

Open ThisMayActuallyBeTyler opened 5 years ago

ThisMayActuallyBeTyler commented 5 years ago

Terraform Version

 2019-03-19 09:03:40 ⌚  MBP-tchamberlain in ~
○ → terraform -v
Terraform v0.11.10

This was also attempted by other users on v0.11.13

Affected Resource(s)

func flattenNetworkInterface(v skytap.Interface) map[string]interface{} {

Terraform Configuration Files

provider "skytap" {
  username = "user"
  api_token = "token"
}

resource "skytap_environment" "MBTest" {
  template_id = "1573547"
  name = "MB Terraform Test (Manual Net)"
  description = "Testing TF deployment flow"
}

resource "skytap_vm" "Add" {
  template_id = "1573547"
  vm_id = "43554601"
  environment_id = "${skytap_environment.MBTest.id}"
  name = "Add"
}

Debug Output

Error: Error applying plan:

1 error(s) occurred:
* skytap_vm.AD: 1 error(s) occurred:
* skytap_vm.AD: unexpected EOF

Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.

panic: runtime error: invalid memory address or nil pointer dereference

2019-03-12T11:34:01.206-0700 [DEBUG] plugin.terraform-provider-skytap_v0.9.0_x4: [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x17e79ac]
2019-03-12T11:34:01.206-0700 [DEBUG] plugin.terraform-provider-skytap_v0.9.0_x4: 
2019-03-12T11:34:01.206-0700 [DEBUG] plugin.terraform-provider-skytap_v0.9.0_x4: goroutine 74 [running]:
2019-03-12T11:34:01.206-0700 [DEBUG] plugin.terraform-provider-skytap_v0.9.0_x4: github.com/terraform-providers/terraform-provider-skytap/skytap.flattenNetworkInterface(0xc4207ef510, 0x0, 0x0, 0xc4207ef520, 0xc4207d5d50, 0x2037b38, 0x0, 0x0, 0xc4207d5d60, 0x2037b38, ...)
2019-03-12T11:34:01.206-0700 [DEBUG] plugin.terraform-provider-skytap_v0.9.0_x4:       /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-skytap/skytap/structures.go:22 +0x15c
2019-03-12T11:34:01.206-0700 [DEBUG] plugin.terraform-provider-skytap_v0.9.0_x4: github.com/terraform-providers/terraform-provider-skytap/skytap.flattenNetworkInterfaces(0xc420506a80, 0x1, 0x4, 0x187c500)
2019-03-12T11:34:01.206-0700 [DEBUG] plugin.terraform-provider-skytap_v0.9.0_x4:       /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-skytap/skytap/structures.go:12 +0x137
2019-03-12T11:34:01.206-0700 [DEBUG] plugin.terraform-provider-skytap_v0.9.0_x4: github.com/terraform-providers/terraform-provider-skytap/skytap.resourceSkytapVMRead(0xc4201de0e0, 0x184e600, 0xc42018f680, 0x0, 0x0)
2019-03-12T11:34:01.206-0700 [DEBUG] plugin.terraform-provider-skytap_v0.9.0_x4:       /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-skytap/skytap/resource_skytap_vm.go:326 +0x5f3
2019-03-12T11:34:01.206-0700 [DEBUG] plugin.terraform-provider-skytap_v0.9.0_x4: github.com/terraform-providers/terraform-provider-skytap/skytap.updateVMResource(0xc4201de0e0, 0x184e600, 0xc42018f680, 0xc42041ed01, 0x8, 0x0)
2019-03-12T11:34:01.206-0700 [DEBUG] plugin.terraform-provider-skytap_v0.9.0_x4:       /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-skytap/skytap/resource_skytap_vm.go:420 +0x8b7
2019-03-12T11:34:01.206-0700 [DEBUG] plugin.terraform-provider-skytap_v0.9.0_x4: github.com/terraform-providers/terraform-provider-skytap/skytap.resourceSkytapVMCreate(0xc4201de0e0, 0x184e600, 0xc42018f680, 0xc4201de0e0, 0x0)
2019-03-12T11:34:01.206-0700 [DEBUG] plugin.terraform-provider-skytap_v0.9.0_x4:       /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-skytap/skytap/resource_skytap_vm.go:166 +0x605
2019-03-12T11:34:01.206-0700 [DEBUG] plugin.terraform-provider-skytap_v0.9.0_x4: github.com/terraform-providers/terraform-provider-skytap/vendor/github.com/hashicorp/terraform/helper/schema.(*Resource).Apply(0xc4201dfc70, 0xc420180280, 0xc42079b920, 0x184e600, 0xc42018f680, 0xc4203e3001, 0xc420877b88, 0x10ba35c)
2019-03-12T11:34:01.206-0700 [DEBUG] plugin.terraform-provider-skytap_v0.9.0_x4:       /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-skytap/vendor/github.com/hashicorp/terraform/helper/schema/resource.go:225 +0x35a
2019-03-12T11:34:01.206-0700 [DEBUG] plugin.terraform-provider-skytap_v0.9.0_x4: github.com/terraform-providers/terraform-provider-skytap/vendor/github.com/hashicorp/terraform/helper/schema.(*Provider).Apply(0xc4201dfce0, 0xc420180230, 0xc420180280, 0xc42079b920, 0xc420877a18, 0xc420370120, 0x13aed93)
2019-03-12T11:34:01.206-0700 [DEBUG] plugin.terraform-provider-skytap_v0.9.0_x4:       /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-skytap/vendor/github.com/hashicorp/terraform/helper/schema/provider.go:283 +0xa4
2019-03-12T11:34:01.207-0700 [DEBUG] plugin.terraform-provider-skytap_v0.9.0_x4: github.com/terraform-providers/terraform-provider-skytap/vendor/github.com/hashicorp/terraform/plugin.(*ResourceProviderServer).Apply(0xc4207f92a0, 0xc42079b8c0, 0xc42031d090, 0x0, 0x0)
2019-03-12T11:34:01.207-0700 [DEBUG] plugin.terraform-provider-skytap_v0.9.0_x4:       /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-skytap/vendor/github.com/hashicorp/terraform/plugin/resource_provider.go:527 +0x57
2019-03-12T11:34:01.207-0700 [DEBUG] plugin.terraform-provider-skytap_v0.9.0_x4: reflect.Value.call(0xc420091680, 0xc42000cd40, 0x13, 0x19f046b, 0x4, 0xc420877f18, 0x3, 0x3, 0xc4200783c0, 0x0, ...)
2019-03-12T11:34:01.207-0700 [DEBUG] plugin.terraform-provider-skytap_v0.9.0_x4:       /opt/goenv/versions/1.10.3/src/reflect/value.go:447 +0x969
2019-03-12T11:34:01.207-0700 [DEBUG] plugin.terraform-provider-skytap_v0.9.0_x4: reflect.Value.Call(0xc420091680, 0xc42000cd40, 0x13, 0xc42036ff18, 0x3, 0x3, 0x0, 0x0, 0x0)
2019-03-12T11:34:01.207-0700 [DEBUG] plugin.terraform-provider-skytap_v0.9.0_x4:       /opt/goenv/versions/1.10.3/src/reflect/value.go:308 +0xa4
2019-03-12T11:34:01.207-0700 [DEBUG] plugin.terraform-provider-skytap_v0.9.0_x4: net/rpc.(*service).call(0xc4203d5f00, 0xc4201746e0, 0xc4207ea8d0, 0xc4207ea8e0, 0xc42018ee00, 0xc4207f92e0, 0x1852b80, 0xc42079b8c0, 0x16, 0x1852bc0, ...)
2019-03-12T11:34:01.207-0700 [DEBUG] plugin.terraform-provider-skytap_v0.9.0_x4:       /opt/goenv/versions/1.10.3/src/net/rpc/server.go:384 +0x14e
2019-03-12T11:34:01.207-0700 [DEBUG] plugin.terraform-provider-skytap_v0.9.0_x4: created by net/rpc.(*Server).ServeCodec
2019-03-12T11:34:01.207-0700 [DEBUG] plugin.terraform-provider-skytap_v0.9.0_x4:       /opt/goenv/versions/1.10.3/src/net/rpc/server.go:480 +0x43a
2019/03/12 11:34:01 [TRACE] root: eval: *terraform.EvalWriteState
2019/03/12 11:34:01 [TRACE] root: eval: *terraform.EvalApplyProvisioners
2019/03/12 11:34:01 [TRACE] root: eval: *terraform.EvalIf
2019/03/12 11:34:01 [TRACE] root: eval: *terraform.EvalWriteState
2019/03/12 11:34:01 [TRACE] root: eval: *terraform.EvalWriteDiff
2019/03/12 11:34:01 [TRACE] root: eval: *terraform.EvalApplyPost
2019/03/12 11:34:01 [ERROR] root: eval: *terraform.EvalApplyPost, err: 1 error(s) occurred:

* skytap_vm.AD: unexpected EOF
2019/03/12 11:34:01 [ERROR] root: eval: *terraform.EvalSequence, err: 1 error(s) occurred:

* skytap_vm.AD: unexpected EOF

2019/03/12 11:34:01 [TRACE] [walkApply] Exiting eval tree: skytap_vm.AD
2019/03/12 11:34:01 [TRACE] dag/walk: upstream errored, not walking "provider.skytap (close)"
2019/03/12 11:34:01 [TRACE] dag/walk: upstream errored, not walking "meta.count-boundary (count boundary fixup)"
2019/03/12 11:34:01 [TRACE] dag/walk: upstream errored, not walking "root"
2019-03-12T11:34:01.210-0700 [DEBUG] plugin: plugin process exited: path=/Users/spollock/ansible/fs-terraform/skytap/.terraform/plugins/darwin_amd64/terraform-provider-skytap_v0.9.0_x4
2019/03/12 11:34:01 [TRACE] Preserving existing state lineage "61fa9320-f422-8739-114a-02640581eae0"
2019/03/12 11:34:01 [TRACE] Preserving existing state lineage "61fa9320-f422-8739-114a-02640581eae0"
2019/03/12 11:34:01 [TRACE] Preserving existing state lineage "61fa9320-f422-8739-114a-02640581eae0"
2019/03/12 11:34:01 [DEBUG] plugin: waiting for all plugin processes to complete...
2019-03-12T11:34:01.212-0700 [WARN ] plugin: error closing client during Kill: err="connection is shut down"

!!!!!!!!!!!!!!!!!!!!!!!!!!! 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 Terraform[1] 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.

[1]: https://github.com/hashicorp/terraform/issues

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

Panic Output

2019-03-19T08:16:58.107-0700 [DEBUG] plugin.terraform-provider-skytap_v0.9.0_x4: 2019/03/19 08:16:58 [INFO] retrieving VM with ID: 43554723
2019-03-19T08:16:58.711-0700 [DEBUG] plugin.terraform-provider-skytap_v0.9.0_x4: panic: runtime error: invalid memory address or nil pointer dereference
2019-03-19T08:16:58.711-0700 [DEBUG] plugin.terraform-provider-skytap_v0.9.0_x4: [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x17e79ac]
2019-03-19T08:16:58.711-0700 [DEBUG] plugin.terraform-provider-skytap_v0.9.0_x4: 
2019-03-19T08:16:58.711-0700 [DEBUG] plugin.terraform-provider-skytap_v0.9.0_x4: goroutine 102 [running]:
2019-03-19T08:16:58.712-0700 [DEBUG] plugin.terraform-provider-skytap_v0.9.0_x4: github.com/terraform-providers/terraform-provider-skytap/skytap.flattenNetworkInterface(0xc4204de960, 0x0, 0x0, 0xc4204de970, 0xc420742c98, 0x2037b38, 0x0, 0x0, 0xc420742cb8, 0x2037b38, ...)
2019-03-19T08:16:58.712-0700 [DEBUG] plugin.terraform-provider-skytap_v0.9.0_x4:    /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-skytap/skytap/structures.go:22 +0x15c
2019-03-19T08:16:58.712-0700 [DEBUG] plugin.terraform-provider-skytap_v0.9.0_x4: github.com/terraform-providers/terraform-provider-skytap/skytap.flattenNetworkInterfaces(0xc420415880, 0x1, 0x4, 0x187c500)
2019-03-19T08:16:58.712-0700 [DEBUG] plugin.terraform-provider-skytap_v0.9.0_x4:    /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-skytap/skytap/structures.go:12 +0x137
2019-03-19T08:16:58.712-0700 [DEBUG] plugin.terraform-provider-skytap_v0.9.0_x4: github.com/terraform-providers/terraform-provider-skytap/skytap.resourceSkytapVMRead(0xc4201ea230, 0x184e600, 0xc420190100, 0x0, 0x0)
2019-03-19T08:16:58.712-0700 [DEBUG] plugin.terraform-provider-skytap_v0.9.0_x4:    /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-skytap/skytap/resource_skytap_vm.go:326 +0x5f3
2019-03-19T08:16:58.712-0700 [DEBUG] plugin.terraform-provider-skytap_v0.9.0_x4: github.com/terraform-providers/terraform-provider-skytap/skytap.updateVMResource(0xc4201ea230, 0x184e600, 0xc420190100, 0xc420593601, 0x8, 0x0)
2019-03-19T08:16:58.712-0700 [DEBUG] plugin.terraform-provider-skytap_v0.9.0_x4:    /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-skytap/skytap/resource_skytap_vm.go:420 +0x8b7
2019-03-19T08:16:58.712-0700 [DEBUG] plugin.terraform-provider-skytap_v0.9.0_x4: github.com/terraform-providers/terraform-provider-skytap/skytap.resourceSkytapVMCreate(0xc4201ea230, 0x184e600, 0xc420190100, 0xc4201ea230, 0x0)
2019-03-19T08:16:58.712-0700 [DEBUG] plugin.terraform-provider-skytap_v0.9.0_x4:    /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-skytap/skytap/resource_skytap_vm.go:166 +0x605
2019-03-19T08:16:58.712-0700 [DEBUG] plugin.terraform-provider-skytap_v0.9.0_x4: github.com/terraform-providers/terraform-provider-skytap/vendor/github.com/hashicorp/terraform/helper/schema.(*Resource).Apply(0xc420485810, 0xc42016c3c0, 0xc420171680, 0x184e600, 0xc420190100, 0xc42057e601, 0xc4203c7b88, 0x10ba35c)
2019-03-19T08:16:58.712-0700 [DEBUG] plugin.terraform-provider-skytap_v0.9.0_x4:    /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-skytap/vendor/github.com/hashicorp/terraform/helper/schema/resource.go:225 +0x35a
2019-03-19T08:16:58.712-0700 [DEBUG] plugin.terraform-provider-skytap_v0.9.0_x4: github.com/terraform-providers/terraform-provider-skytap/vendor/github.com/hashicorp/terraform/helper/schema.(*Provider).Apply(0xc420485880, 0xc42016c370, 0xc42016c3c0, 0xc420171680, 0xc4203c7a18, 0xc420382120, 0x13aed93)
2019-03-19T08:16:58.712-0700 [DEBUG] plugin.terraform-provider-skytap_v0.9.0_x4:    /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-skytap/vendor/github.com/hashicorp/terraform/helper/schema/provider.go:283 +0xa4
2019-03-19T08:16:58.712-0700 [DEBUG] plugin.terraform-provider-skytap_v0.9.0_x4: github.com/terraform-providers/terraform-provider-skytap/vendor/github.com/hashicorp/terraform/plugin.(*ResourceProviderServer).Apply(0xc4204827a0, 0xc420171620, 0xc4204b3ac0, 0x0, 0x0)
2019-03-19T08:16:58.712-0700 [DEBUG] plugin.terraform-provider-skytap_v0.9.0_x4:    /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-skytap/vendor/github.com/hashicorp/terraform/plugin/resource_provider.go:527 +0x57
2019-03-19T08:16:58.712-0700 [DEBUG] plugin.terraform-provider-skytap_v0.9.0_x4: reflect.Value.call(0xc420382840, 0xc420174ed8, 0x13, 0x19f046b, 0x4, 0xc4203c7f18, 0x3, 0x3, 0xc420576000, 0x0, ...)
2019-03-19T08:16:58.713-0700 [DEBUG] plugin.terraform-provider-skytap_v0.9.0_x4:    /opt/goenv/versions/1.10.3/src/reflect/value.go:447 +0x969
2019-03-19T08:16:58.713-0700 [DEBUG] plugin.terraform-provider-skytap_v0.9.0_x4: reflect.Value.Call(0xc420382840, 0xc420174ed8, 0x13, 0xc4207fc718, 0x3, 0x3, 0x0, 0x0, 0x0)
2019-03-19T08:16:58.713-0700 [DEBUG] plugin.terraform-provider-skytap_v0.9.0_x4:    /opt/goenv/versions/1.10.3/src/reflect/value.go:308 +0xa4
2019-03-19T08:16:58.713-0700 [DEBUG] plugin.terraform-provider-skytap_v0.9.0_x4: net/rpc.(*service).call(0xc4204d4100, 0xc42016c8c0, 0xc420176dd0, 0xc420176de0, 0xc420385580, 0xc4204ce5a0, 0x1852b80, 0xc420171620, 0x16, 0x1852bc0, ...)
2019-03-19T08:16:58.713-0700 [DEBUG] plugin.terraform-provider-skytap_v0.9.0_x4:    /opt/goenv/versions/1.10.3/src/net/rpc/server.go:384 +0x14e
2019-03-19T08:16:58.713-0700 [DEBUG] plugin.terraform-provider-skytap_v0.9.0_x4: created by net/rpc.(*Server).ServeCodec
2019-03-19T08:16:58.713-0700 [DEBUG] plugin.terraform-provider-skytap_v0.9.0_x4:    /opt/goenv/versions/1.10.3/src/net/rpc/server.go:480 +0x43a
2019/03/19 08:16:58 [TRACE] root: eval: *terraform.EvalWriteState
2019/03/19 08:16:58 [TRACE] root: eval: *terraform.EvalApplyProvisioners
2019/03/19 08:16:58 [TRACE] root: eval: *terraform.EvalIf
2019/03/19 08:16:58 [TRACE] root: eval: *terraform.EvalWriteState
2019/03/19 08:16:58 [TRACE] root: eval: *terraform.EvalWriteDiff
2019/03/19 08:16:58 [TRACE] root: eval: *terraform.EvalApplyPost
2019/03/19 08:16:58 [ERROR] root: eval: *terraform.EvalApplyPost, err: 1 error(s) occurred:
* skytap_vm.Add: unexpected EOF
2019/03/19 08:16:58 [ERROR] root: eval: *terraform.EvalSequence, err: 1 error(s) occurred:
* skytap_vm.Add: unexpected EOF
2019/03/19 08:16:58 [TRACE] [walkApply] Exiting eval tree: skytap_vm.Add
2019/03/19 08:16:58 [TRACE] dag/walk: upstream errored, not walking "provider.skytap (close)"
2019/03/19 08:16:58 [TRACE] dag/walk: upstream errored, not walking "meta.count-boundary (count boundary fixup)"
2019/03/19 08:16:58 [TRACE] dag/walk: upstream errored, not walking "root"
2019/03/19 08:16:58 [TRACE] Preserving existing state lineage "70d2e9fa-8135-4263-445e-b4efc203402c"
2019-03-19T08:16:58.716-0700 [DEBUG] plugin: plugin process exited: path="/Users/mbowman/Documents/Support Cases/2177_terraform-segfault/testing/.terraform/plugins/darwin_amd64/terraform-provider-skytap_v0.9.0_x4"
2019/03/19 08:16:58 [DEBUG] plugin: waiting for all plugin processes to complete...
2019-03-19T08:16:58.731-0700 [WARN ] plugin: error closing client during Kill: err="connection is shut down"

Expected Behavior

Terraform should add a VM from a template to the designated environment regardless of automatic or manual networks.

Actual Behavior

It seems like adding a VM connected to a manual network to an existing environment in Terraform causes Terraform to crash. The environment and corresponding add VM functionaility completes in Skytap as expected. However, Terraform crashes despite the process completing within Skytap

Steps to Reproduce

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

  1. Create a Template within Skytap containing a VM with an adapter connected to a manual network.
  2. Reference the VM ID of the VM contained within that template when attempting to add the VM to a Skytap Environment in a Terraform configuration file.
  3. terraform apply

Important Factoids

This may be related to "null" values retrieved in the "interfaces" section of JSON retrieved for a VM with one NIC on a manual network

"interfaces": [
    {
      "hostname": null,
      "id": "nic-xxxxxxx-xxxxxxxx-x",
      "ip": null,
      "mac": "00:50:56:00:EE:E5",
      "network_id": "87654321",
      "network_name": "Mgmt",
      "network_subnet": "10.0.3.0/24",
      "network_type": "manual",
      "network_url": "https://cloud.skytap.com/v2/configurations/123454678/networks/87654321",
      "nic_type": "vmxnet3",
      "promiscuous": false,
      "public_ip_attachments": [],
      "public_ips": [],
      "public_ips_count": 0,
      "secondary_ips": [],
      "services": [],
      "services_count": 0,
      "status": "Running",
      "vm_id": "5555555",
      "vm_name": "Add"
    }
  ],
pegerto commented 5 years ago

Hello @ThisMayActuallyBeTyler

Thank you for the detail report, we didn't consider manual networks for the MVP of the connector, but unfortunately, we have considered the case where the manual network come from the template.

There isn't an acceptance test validating this scenario. An acceptant test should be added as part of this ticket.

Regards.

thewellington commented 5 years ago

Hi James. I talked with Tyler and got the steps to reproduce this issue. They are as documented above.

Steps to Reproduce

  1. Create a Template within Skytap containing a VM with an adapter connected to a manual network.
  2. Reference the VM ID of the VM contained within that template when attempting to add the VM to a Skytap Environment in a Terraform configuration file.
  3. terraform apply

Here is my code:

variable "skytap_username" {}
variable "skytap_api_token" {}

provider "skytap" {
  username = "${var.skytap_username}"
  api_token = "${var.skytap_api_token}"
}

resource "skytap_environment" "MBTest" {
  template_id = "1652071"
  name = "MB Terraform Test (Manual Net)"
  description = "Testing TF deployment flow"
}

resource "skytap_vm" "Add" {
  template_id = "1652071"
  vm_id = "48749233"
  environment_id = "${skytap_environment.MBTest.id}"
  name = "Add"
}

Here is the result:

[thewellington:~/Development … ps_stacks/issue29] dev(+34/-18)* ± terraform apply

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  + skytap_environment.MBTest
      id:                  <computed>
      description:         "Testing TF deployment flow"
      name:                "MB Terraform Test (Manual Net)"
      outbound_traffic:    "false"
      routable:            "false"
      template_id:         "1652071"

  + skytap_vm.Add
      id:                  <computed>
      cpus:                <computed>
      environment_id:      "${skytap_environment.MBTest.id}"
      max_cpus:            <computed>
      max_ram:             <computed>
      name:                "Add"
      network_interface.#: <computed>
      os_disk_size:        <computed>
      ram:                 <computed>
      service_ips.%:       <computed>
      service_ports.%:     <computed>
      template_id:         "1652071"
      vm_id:               "48749233"

Plan: 2 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

skytap_environment.MBTest: Creating...
  description:      "" => "Testing TF deployment flow"
  name:             "" => "MB Terraform Test (Manual Net)"
  outbound_traffic: "" => "false"
  routable:         "" => "false"
  template_id:      "" => "1652071"
skytap_environment.MBTest: Still creating... (10s elapsed)
skytap_environment.MBTest: Still creating... (20s elapsed)
skytap_environment.MBTest: Still creating... (30s elapsed)
skytap_environment.MBTest: Still creating... (40s elapsed)
skytap_environment.MBTest: Still creating... (50s elapsed)
skytap_environment.MBTest: Creation complete after 56s (ID: 56190286)
skytap_vm.Add: Creating...
  cpus:                "" => "<computed>"
  environment_id:      "" => "56190286"
  max_cpus:            "" => "<computed>"
  max_ram:             "" => "<computed>"
  name:                "" => "Add"
  network_interface.#: "" => "<computed>"
  os_disk_size:        "" => "<computed>"
  ram:                 "" => "<computed>"
  service_ips.%:       "" => "<computed>"
  service_ports.%:     "" => "<computed>"
  template_id:         "" => "1652071"
  vm_id:               "" => "48749233"
skytap_vm.Add: Still creating... (10s elapsed)
skytap_vm.Add: Still creating... (20s elapsed)
skytap_vm.Add: Still creating... (30s elapsed)
skytap_vm.Add: Still creating... (40s elapsed)
skytap_vm.Add: Still creating... (50s elapsed)
skytap_vm.Add: Still creating... (1m0s elapsed)
skytap_vm.Add: Still creating... (1m10s elapsed)
skytap_vm.Add: Still creating... (1m20s elapsed)
skytap_vm.Add: Still creating... (1m30s elapsed)
skytap_vm.Add: Still creating... (1m40s elapsed)

Error: Error applying plan:

1 error(s) occurred:

* skytap_vm.Add: 1 error(s) occurred:

* skytap_vm.Add: unexpected EOF

Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.

panic: runtime error: invalid memory address or nil pointer dereference
2019-06-19T11:28:28.716-0700 [DEBUG] plugin.terraform-provider-skytap: [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x18e2552]
2019-06-19T11:28:28.716-0700 [DEBUG] plugin.terraform-provider-skytap:
2019-06-19T11:28:28.716-0700 [DEBUG] plugin.terraform-provider-skytap: goroutine 89 [running]:
2019-06-19T11:28:28.716-0700 [DEBUG] plugin.terraform-provider-skytap: github.com/terraform-providers/terraform-provider-skytap/skytap.flattenNetworkInterface(0xc00058ac90, 0x0, 0x0, 0xc00058aca0, 0xc0004a3e78, 0x24deda8, 0x0, 0x0, 0xc0004a3f10, 0x24deda8, ...)
2019-06-19T11:28:28.716-0700 [DEBUG] plugin.terraform-provider-skytap:  /Users/thewellington/Development/go/src/github.com/terraform-providers/terraform-provider-skytap/skytap/structures.go:27 +0x1a2
2019-06-19T11:28:28.716-0700 [DEBUG] plugin.terraform-provider-skytap: github.com/terraform-providers/terraform-provider-skytap/skytap.flattenNetworkInterfaces(0xc00048ee00, 0x1, 0x4, 0x0)
2019-06-19T11:28:28.716-0700 [DEBUG] plugin.terraform-provider-skytap:  /Users/thewellington/Development/go/src/github.com/terraform-providers/terraform-provider-skytap/skytap/structures.go:16 +0xfc
2019-06-19T11:28:28.716-0700 [DEBUG] plugin.terraform-provider-skytap: github.com/terraform-providers/terraform-provider-skytap/skytap.resourceSkytapVMReadAfterCreateUpdate(0xc0002824d0, 0x194db60, 0xc00049a080, 0x0, 0x0, 0x1ac0b60, 0xc000622000, 0x0, 0xc000622000)
2019-06-19T11:28:28.716-0700 [DEBUG] plugin.terraform-provider-skytap:  /Users/thewellington/Development/go/src/github.com/terraform-providers/terraform-provider-skytap/skytap/resource_skytap_vm.go:317 +0xfc8
2019-06-19T11:28:28.716-0700 [DEBUG] plugin.terraform-provider-skytap: github.com/terraform-providers/terraform-provider-skytap/skytap.resourceSkytapVMCreate(0xc0002824d0, 0x194db60, 0xc00049a080, 0xc0002824d0, 0x0)
2019-06-19T11:28:28.716-0700 [DEBUG] plugin.terraform-provider-skytap:  /Users/thewellington/Development/go/src/github.com/terraform-providers/terraform-provider-skytap/skytap/resource_skytap_vm.go:258 +0x717
2019-06-19T11:28:28.716-0700 [DEBUG] plugin.terraform-provider-skytap: github.com/terraform-providers/terraform-provider-skytap/vendor/github.com/hashicorp/terraform/helper/schema.(*Resource).Apply(0xc0004447e0, 0xc000370410, 0xc0001bcee0, 0x194db60, 0xc00049a080, 0x1, 0x0, 0x0)
2019-06-19T11:28:28.716-0700 [DEBUG] plugin.terraform-provider-skytap:  /Users/thewellington/Development/go/src/github.com/terraform-providers/terraform-provider-skytap/vendor/github.com/hashicorp/terraform/helper/schema/resource.go:225 +0x3a2
2019-06-19T11:28:28.716-0700 [DEBUG] plugin.terraform-provider-skytap: github.com/terraform-providers/terraform-provider-skytap/vendor/github.com/hashicorp/terraform/helper/schema.(*Provider).Apply(0xc000444850, 0xc0003703c0, 0xc000370410, 0xc0001bcee0, 0xc0003bf950, 0xc0003bedb0, 0x18)
2019-06-19T11:28:28.716-0700 [DEBUG] plugin.terraform-provider-skytap:  /Users/thewellington/Development/go/src/github.com/terraform-providers/terraform-provider-skytap/vendor/github.com/hashicorp/terraform/helper/schema/provider.go:283 +0x18f
2019-06-19T11:28:28.716-0700 [DEBUG] plugin.terraform-provider-skytap: github.com/terraform-providers/terraform-provider-skytap/vendor/github.com/hashicorp/terraform/plugin.(*ResourceProviderServer).Apply(0xc0003821e0, 0xc0001bce60, 0xc000474480, 0x0, 0x0)
2019-06-19T11:28:28.716-0700 [DEBUG] plugin.terraform-provider-skytap:  /Users/thewellington/Development/go/src/github.com/terraform-providers/terraform-provider-skytap/vendor/github.com/hashicorp/terraform/plugin/resource_provider.go:527 +0x57
2019-06-19T11:28:28.717-0700 [DEBUG] plugin.terraform-provider-skytap: reflect.Value.call(0xc0000ab440, 0xc00016a840, 0x13, 0x1afa288, 0x4, 0xc0006a4f18, 0x3, 0x3, 0xc0000d8a40, 0x0, ...)
2019-06-19T11:28:28.717-0700 [DEBUG] plugin.terraform-provider-skytap:  /usr/local/go/src/reflect/value.go:447 +0x461
2019-06-19T11:28:28.717-0700 [DEBUG] plugin.terraform-provider-skytap: reflect.Value.Call(0xc0000ab440, 0xc00016a840, 0x13, 0xc0001b5f18, 0x3, 0x3, 0x0, 0x0, 0x0)
2019-06-19T11:28:28.717-0700 [DEBUG] plugin.terraform-provider-skytap:  /usr/local/go/src/reflect/value.go:308 +0xa4
2019-06-19T11:28:28.717-0700 [DEBUG] plugin.terraform-provider-skytap: net/rpc.(*service).call(0xc0003d6040, 0xc000172460, 0xc00014a640, 0xc00014a650, 0xc000148680, 0xc000169340, 0x19520e0, 0xc0001bce60, 0x16, 0x1952120, ...)
2019-06-19T11:28:28.717-0700 [DEBUG] plugin.terraform-provider-skytap:  /usr/local/go/src/net/rpc/server.go:384 +0x14e
2019-06-19T11:28:28.717-0700 [DEBUG] plugin.terraform-provider-skytap: created by net/rpc.(*Server).ServeCodec
2019-06-19T11:28:28.717-0700 [DEBUG] plugin.terraform-provider-skytap:  /usr/local/go/src/net/rpc/server.go:481 +0x42b
2019/06/19 11:28:28 [TRACE] root: eval: *terraform.EvalWriteState
2019/06/19 11:28:28 [TRACE] root: eval: *terraform.EvalApplyProvisioners
2019/06/19 11:28:28 [TRACE] root: eval: *terraform.EvalIf
2019/06/19 11:28:28 [TRACE] root: eval: *terraform.EvalWriteState
2019/06/19 11:28:28 [TRACE] root: eval: *terraform.EvalWriteDiff
2019/06/19 11:28:28 [TRACE] root: eval: *terraform.EvalApplyPost
2019/06/19 11:28:28 [ERROR] root: eval: *terraform.EvalApplyPost, err: 1 error(s) occurred:

* skytap_vm.Add: unexpected EOF
2019/06/19 11:28:28 [ERROR] root: eval: *terraform.EvalSequence, err: 1 error(s) occurred:

* skytap_vm.Add: unexpected EOF
2019/06/19 11:28:28 [TRACE] [walkApply] Exiting eval tree: skytap_vm.Add
2019/06/19 11:28:28 [TRACE] dag/walk: upstream errored, not walking "provider.skytap (close)"
2019/06/19 11:28:28 [TRACE] dag/walk: upstream errored, not walking "meta.count-boundary (count boundary fixup)"
2019-06-19T11:28:28.720-0700 [DEBUG] plugin: plugin process exited: path=/Users/thewellington/.terraform.d/plugins/terraform-provider-skytap
2019/06/19 11:28:28 [TRACE] dag/walk: upstream errored, not walking "root"
2019/06/19 11:28:28 [TRACE] Preserving existing state lineage "2021d718-ac31-b046-40fc-c3afcf0e10d4"
2019/06/19 11:28:28 [TRACE] Preserving existing state lineage "2021d718-ac31-b046-40fc-c3afcf0e10d4"
2019/06/19 11:28:28 [TRACE] Preserving existing state lineage "2021d718-ac31-b046-40fc-c3afcf0e10d4"
2019/06/19 11:28:28 [DEBUG] plugin: waiting for all plugin processes to complete...
2019-06-19T11:28:28.808-0700 [WARN ] plugin: error closing client during Kill: err="connection is shut down"

!!!!!!!!!!!!!!!!!!!!!!!!!!! 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 Terraform[1] 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.

[1]: https://github.com/hashicorp/terraform/issues

!!!!!!!!!!!!!!!!!!!!!!!!!!! TERRAFORM CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!
[thewellington:~/Development … ps_stacks/issue29] dev(+34/-18)* 1 ±

Because I cannot share the template with your account, you will have to go through the steps to reproduce yourself. I can assist w/ that. We can chat tomorrow.

Also, I am still running the code I built, equal to v0.10

[thewellington:~/Development … ps_stacks/issue29] dev(+34/-18)* 127 ± terraform -version
Terraform v0.11.13
+ provider.skytap (unversioned)
ja6a commented 5 years ago

👍