weixin_39800062
2020-12-25 18:08 阅读 3

TERRAFORM CRASH

Terraform Version

Terraform v0.12.24

vSphere Provider Version

provider.vsphere v1.17.2

Affected Resource(s)

vsphere_virtual_machine

Terraform Configuration Files


> 
> variable "vsphere_user"{}
> variable "vsphere_password"{}
> variable "vsphere_server"{}
> 
> provider "vsphere" {
>  user = var.vsphere_user
>  password = var.vsphere_password
>  vsphere_server = var.vsphere_server
>  allow_unverified_ssl = true
> }
> 
> data "vsphere_datacenter" "dc" {
>   name = "TaiPing"
> }
> 
> data "vsphere_datastore" "datastore" {
>   name          = "datastore1"
>   datacenter_id = data.vsphere_datacenter.dc.id
> }
> 
> data "vsphere_compute_cluster" "cluster" {
>   name          = "tp-vmgp01"
>   datacenter_id = data.vsphere_datacenter.dc.id
> }
> 
> data "vsphere_network" "network" {
>   name          = "vmvlan140"
>   datacenter_id = data.vsphere_datacenter.dc.id
> }
> 
> data "vsphere_virtual_machine" "template" {
>   name          = "Thomas_template"
>   datacenter_id = data.vsphere_datacenter.dc.id
> }
> 
> resource "vsphere_virtual_machine" "clone_vm" {
>   name             = "clone_vm"
>   resource_pool_id = data.vsphere_compute_cluster.cluster.resource_pool_id
>   datastore_id     = data.vsphere_datastore.datastore.id
> 
> #wait_for_guest_ip_timeout=1#default=5
> wait_for_guest_net_timeout=0
>   num_cpus = 1#default=1
>   memory   = 512#default=1024
>   guest_id = data.vsphere_virtual_machine.template.guest_id
> 
>   scsi_type = data.vsphere_virtual_machine.template.scsi_type
> 
>   network_interface {
>   network_id   = data.vsphere_network.network.id
>   adapter_type = data.vsphere_virtual_machine.template.network_interface_types[0]
>   }
> 
>   disk {
>     label            = "disk0"
>     size             = data.vsphere_virtual_machine.template.disks.0.size
>     eagerly_scrub    = data.vsphere_virtual_machine.template.disks.0.eagerly_scrub
>     thin_provisioned = data.vsphere_virtual_machine.template.disks.0.thin_provisioned
>   }
> 
>    clone {
>     template_uuid = data.vsphere_virtual_machine.template.id//uuid ofsource vm or template
>    // timeout=0
>     customize {
>       linux_options {
>         host_name = "terraform-test"
>         domain    = "test.internal"
>       }
> 
>       network_interface {
>         ipv4_address = "192.168.140.222"
>         ipv4_netmask = 24
>       }
> 
>       ipv4_gateway =  "192.168.143.253"
>     }
>   }
> }
> 

Panic Output

crash.log

Debug Output


Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.

data.vsphere_datacenter.dc: Refreshing state...
data.vsphere_network.network: Refreshing state...
data.vsphere_datastore.datastore: Refreshing state...
data.vsphere_virtual_machine.template: Refreshing state...
data.vsphere_compute_cluster.cluster: Refreshing state...

------------------------------------------------------------------------

Error: rpc error: code = Unavailable desc = transport is closing



Error: rpc error: code = Unavailable desc = transport is closing


panic: runtime error: invalid memory address or nil pointer dereference
2020-04-27T16:12:25.655+0800 [DEBUG] plugin.terraform-provider-vsphere_v1.17.2_x4.exe: [signal 0xc0000005 code=0x0 addr=0x0 pc=0x11ac5a1]
2020-04-27T16:12:25.655+0800 [DEBUG] plugin.terraform-provider-vsphere_v1.17.2_x4.exe:
2020-04-27T16:12:25.655+0800 [DEBUG] plugin.terraform-provider-vsphere_v1.17.2_x4.exe: goroutine 51 [running]:
2020-04-27T16:12:25.655+0800 [DEBUG] plugin.terraform-provider-vsphere_v1.17.2_x4.exe: github.com/vmware/govmomi/vapi/rest.(*Client).Resource(...)
2020-04-27T16:12:25.655+0800 [DEBUG] plugin.terraform-provider-vsphere_v1.17.2_x4.exe:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-vsphere/vendor/github.com/vmware/govmomi/vapi/rest/client.go:67
2020-04-27T16:12:25.655+0800 [DEBUG] plugin.terraform-provider-vsphere_v1.17.2_x4.exe: github.com/vmware/govmomi/vapi/library.(*Manager).GetLibraryItem(0xc0003a3170, 0x1bffc40, 0xc00002a0b8, 0xc000126030, 0x24, 0x100, 0x89, 0x14)
2020-04-27T16:12:25.655+0800 [DEBUG] plugin.terraform-provider-vsphere_v1.17.2_x4.exe:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-vsphere/vendor/github.com/vmware/govmomi/vapi/library/library_item.go:115 +0x31
2020-04-27T16:12:25.655+0800 [DEBUG] plugin.terraform-provider-vsphere_v1.17.2_x4.exe: github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/contentlibrary.ItemFromID(0x0, 0xc000126030, 0x24, 0x1, 0x1, 0x0)
2020-04-27T16:12:25.655+0800 [DEBUG] plugin.terraform-provider-vsphere_v1.17.2_x4.exe:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/contentlibrary/content_library_helper.go:116 +0x102
2020-04-27T16:12:25.655+0800 [DEBUG] plugin.terraform-provider-vsphere_v1.17.2_x4.exe: github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/contentlibrary.IsContentLibraryItem(0x0, 0xc000126030, 0x24, 0x14ace40)
2020-04-27T16:12:25.655+0800 [DEBUG] plugin.terraform-provider-vsphere_v1.17.2_x4.exe:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/contentlibrary/content_library_helper.go:127 +0xb5
2020-04-27T16:12:25.656+0800 [DEBUG] plugin.terraform-provider-vsphere_v1.17.2_x4.exe: github.com/terraform-providers/terraform-provider-vsphere/vsphere.resourceVSphereVirtualMachineCustomizeDiff(0xc000056240, 0x151b180, 0xc00057a620, 0xc000117ca0, 0xc000056240)
2020-04-27T16:12:25.656+0800 [DEBUG] plugin.terraform-provider-vsphere_v1.17.2_x4.exe:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-vsphere/vsphere/resource_vsphere_virtual_machine.go:877 +0x955
2020-04-27T16:12:25.656+0800 [DEBUG] plugin.terraform-provider-vsphere_v1.17.2_x4.exe: github.com/hashicorp/terraform-plugin-sdk/helper/schema.schemaMap.Diff(0xc0000f9890, 0xc00055a140, 0xc00023aa80, 0x18a8d70, 0x151b180, 0xc00057a620, 0x1812f00, 0x1c00880, 0xffffffffffffffff, 0x0)
2020-04-27T16:12:25.656+0800 [DEBUG] plugin.terraform-provider-vsphere_v1.17.2_x4.exe:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-vsphere/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/schema.go:518 +0xaca
2020-04-27T16:12:25.656+0800 [DEBUG] plugin.terraform-provider-vsphere_v1.17.2_x4.exe: github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Resource).simpleDiff(0xc000125880, 0xc00055a140, 0xc00023aa80, 0x151b180, 0xc00057a620, 0x1, 0xc000128620, 0xc00023aa80)
2020-04-27T16:12:25.656+0800 [DEBUG] plugin.terraform-provider-vsphere_v1.17.2_x4.exe:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-vsphere/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/resource.go:351 +0x8c
2020-04-27T16:12:25.656+0800 [DEBUG] plugin.terraform-provider-vsphere_v1.17.2_x4.exe: github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Provider).SimpleDiff(0xc000172780, 0xc00019bac8, 0xc00055a140, 0xc00023aa80, 0xc00023c090, 0xc00023aa80, 0x0)
2020-04-27T16:12:25.656+0800 [DEBUG] plugin.terraform-provider-vsphere_v1.17.2_x4.exe:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-vsphere/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/provider.go:321 +0x196
2020-04-27T16:12:25.656+0800 [DEBUG] plugin.terraform-provider-vsphere_v1.17.2_x4.exe: github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin.(*GRPCProviderServer).PlanResourceChange(0xc000006600, 0x1bffcc0, 0xc0004c6150, 0xc0005240c0, 0xc000006600, 0xc0004c6150, 0xc0004dbbd0)
2020-04-27T16:12:25.656+0800 [DEBUG] plugin.terraform-provider-vsphere_v1.17.2_x4.exe:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-vsphere/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin/grpc_provider.go:633 +0x79b
2020-04-27T16:12:25.656+0800 [DEBUG] plugin.terraform-provider-vsphere_v1.17.2_x4.exe: github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5._Provider_PlanResourceChange_Handler(0x17cc0a0, 0xc000006600, 0x1bffcc0, 0xc0004c6150, 0xc000524060, 0x0, 0x1bffcc0, 0xc0004c6150, 0xc00045ec00, 0x1228)
2020-04-27T16:12:25.656+0800 [DEBUG] plugin.terraform-provider-vsphere_v1.17.2_x4.exe:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-vsphere/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5/tfplugin5.pb.go:3171 +0x245
2020-04-27T16:12:25.656+0800 [DEBUG] plugin.terraform-provider-vsphere_v1.17.2_x4.exe: google.golang.org/grpc.(*Server).processUnaryRPC(0xc0000a8160, 0x1c0f1a0, 0xc00004bb00, 0xc0004d2000, 0xc0000f9230, 0x2a9dfc8, 0x0, 0x0, 0x0)
2020-04-27T16:12:25.656+0800 [DEBUG] plugin.terraform-provider-vsphere_v1.17.2_x4.exe:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-vsphere/vendor/google.golang.org/grpc/server.go:995 +0x46d
2020-04-27T16:12:25.656+0800 [DEBUG] plugin.terraform-provider-vsphere_v1.17.2_x4.exe: google.golang.org/grpc.(*Server).handleStream(0xc0000a8160, 0x1c0f1a0, 0xc00004bb00, 0xc0004d2000, 0x0)
2020-04-27T16:12:25.656+0800 [DEBUG] plugin.terraform-provider-vsphere_v1.17.2_x4.exe:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-vsphere/vendor/google.golang.org/grpc/server.go:1275 +0xdad
2020-04-27T16:12:25.656+0800 [DEBUG] plugin.terraform-provider-vsphere_v1.17.2_x4.exe: google.golang.org/grpc.(*Server).serveStreams.func1.1(0xc00002a340, 0xc0000a8160, 0x1c0f1a0, 0xc00004bb00, 0xc0004d2000)
2020-04-27T16:12:25.656+0800 [DEBUG] plugin.terraform-provider-vsphere_v1.17.2_x4.exe:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-vsphere/vendor/google.golang.org/grpc/server.go:710 +0xa6
2020-04-27T16:12:25.656+0800 [DEBUG] plugin.terraform-provider-vsphere_v1.17.2_x4.exe: created by google.golang.org/grpc.(*Server).serveStreams.func1
2020-04-27T16:12:25.656+0800 [DEBUG] plugin.terraform-provider-vsphere_v1.17.2_x4.exe:  /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-vsphere/vendor/google.golang.org/grpc/server.go:708 +0xa8
2020/04/27 16:12:25 [ERROR] <root>: eval: *terraform.EvalDiff, err: rpc error: code = Unavailable desc = transport is closing
2020/04/27 16:12:25 [ERROR] <root>: eval: *terraform.EvalSequence, err: rpc error: code = Unavailable desc = transport is closing
2020/04/27 16:12:25 [TRACE] [walkPlan] Exiting eval tree: vsphere_virtual_machine.clone_vm
2020/04/27 16:12:25 [ERROR] <root>: eval: *terraform.EvalDiff, err: rpc error: code = Unavailable desc = transport is closing
2020/04/27 16:12:25 [TRACE] vertex "vsphere_virtual_machine.clone_vm": visit complete
2020/04/27 16:12:25 [ERROR] <root>: eval: *terraform.EvalSequence, err: rpc error: code = Unavailable desc = transport is closing
2020/04/27 16:12:25 [TRACE] [walkPlan] Exiting eval tree: vsphere_virtual_machine.new_vm
2020/04/27 16:12:25 [TRACE] vertex "vsphere_virtual_machine.clone_vm": dynamic subgraph encountered errors
2020/04/27 16:12:25 [TRACE] vertex "vsphere_virtual_machine.new_vm": visit complete
2020/04/27 16:12:25 [TRACE] vertex "vsphere_virtual_machine.clone_vm": visit complete
2020/04/27 16:12:25 [TRACE] vertex "vsphere_virtual_machine.new_vm": dynamic subgraph encountered errors
2020/04/27 16:12:25 [TRACE] vertex "vsphere_virtual_machine.new_vm": visit complete
2020/04/27 16:12:25 [TRACE] dag/walk: upstream of "meta.count-boundary (EachMode fixup)" errored, so skipping
2020/04/27 16:12:25 [TRACE] dag/walk: upstream of "provider.vsphere (close)" errored, so skipping
2020/04/27 16:12:25 [TRACE] dag/walk: upstream of "root" errored, so skipping
2020/04/27 16:12:25 [INFO] backend/local: plan operation completed
2020/04/27 16:12:25 [TRACE] statemgr.Filesystem: removing lock metadata file .terraform.tfstate.lock.info
2020/04/27 16:12:25 [TRACE] statemgr.Filesystem: unlocked by closing terraform.tfstate
2020-04-27T16:12:25.668+0800 [DEBUG] plugin: plugin process exited: path=C:\terraform\.terraform\plugins\windows_amd64\terraform-provider-vsphere_v1.17.2_x4.exe pid=11260 error="exit status 2"
2020-04-27T16:12:25.668+0800 [DEBUG] plugin: plugin exited



!!!!!!!!!!!!!!!!!!!!!!!!!!! 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.

SECURITY WARNING: the "crash.log" file that was created may contain
sensitive information that must be redacted before it is safe to share
on the issue tracker.

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

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

</root></root></root></root>

Expected Behavior

clone a VM

Actual Behavior

crash

Steps to Reproduce

  1. terraform apply

Important Factoids

References

该提问来源于开源项目:hashicorp/terraform-provider-vsphere

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

4条回答 默认 最新

  • weixin_39800331 weixin_39800331 2020-12-25 18:08

    Hi ! Does this happen with all cloned VMs or is it specific to the config that you posted? If it does not happen with all VMs, is there something the affected ones have in common?

    点赞 评论 复制链接分享
  • weixin_39800062 weixin_39800062 2020-12-25 18:08

    Hi bill-rich. Yes, It happen with all cloned VMs. I've tried several versions of vsphere provider. I found that only using v1.17.2 will show "TERRAFORM CRASH", only using v1.16.2 will clone sucessfuly, and the others will show

    
    
    Error: POST https://10.68.101.17/rest/com/vmware/cis/session: 503 Service Unavailable (Failed to connect to endpoint: [N7Vmacore4Http16LocalServiceSpecE:0x7f43b0077350] _serverNamespace = /rest _isRedirect = false _port = 12346)
    
     on clone_example.tf line 5, in provider "vsphere":
     5: provider "vsphere" {
    
    
    点赞 评论 复制链接分享
  • weixin_39800331 weixin_39800331 2020-12-25 18:08

    Hey . I've looked into the problem and have a pretty good idea on what is causing the issue. Can you please do a terraform apply with the latest version of the provider and set "TF_LOG=DEBUG", and then post the output. I just need to determine if the issue is a result of a problem with the REST client, or a malformed API call.

    Thanks!

    点赞 评论 复制链接分享
  • weixin_39717598 weixin_39717598 2020-12-25 18:08

    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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback.com. Thanks!

    点赞 评论 复制链接分享

相关推荐