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

Run plan with existing local state file against resource that has changed crashes Terraform with 'Error: rpc error: code = Unavailable desc = transport is closing' #869

Closed
pauledavey opened this issue Oct 16, 2019 · 2 comments
Labels
crash Impact: Crash

Comments

@pauledavey
Copy link

pauledavey commented Oct 16, 2019

Terraform version: v0.12.10
vSphere Provider version: v1.13.0

I have a simple script to add a portgroup to an ESXi host (as follows)

data "vsphere_datacenter" "datacenter" {
  name = "AutomationCore"
}

data "vsphere_host" "esxi_host" {
  name          = "${var.esxi_hostName}"
  datacenter_id = "${data.vsphere_datacenter.datacenter.id}"
}

resource "vsphere_host_port_group" "pg" {
  name                = "PGTerraformTest"
  host_system_id      = "${data.vsphere_host.esxi_host.id}"
  virtual_switch_name = "vSwitch0"
  vlan_id = 4095
  allow_promiscuous = true
}

This adds the portgroup to a host specified as a variable correctly. I can plan and apply successfully.
Following this I can run plan again against the same host. It states that the same resource needs to be created again (1 to add) which I find strange. If I attempt to apply it tells me the resource already exists.

If I manually change the vLAN on the portgroup from 4095 to something else (i.e. 999) and then run plan against the host, Terraform crashes. My understanding is that it should show me that there is a difference between the locally saved state file and the deployed portgroup. I have this issue against multiple ESXi hosts.

I have attached the crash.log file to this issue ticket.
crash.log

@aareet aareet added the crash Impact: Crash label Oct 16, 2019
@koikonom
Copy link
Contributor

koikonom commented Oct 30, 2019

HI @pauledavey! Thanks for taking the time to report this issue.

I tried to reproduce this against my own vsphere lab with little success. Can you please reproduce the issue, with the environment variable TF_LOG set to DEBUG before running terraform, and upload the debug output ?

You don't have to repeat the whole process. I am interested in seeing why terraform believes it needs to create the resource again, so I just need the debug logs of the plan operation right after the resource has been created.

The logs from the resource creation are useful too, assuming you can get these as well.

koikonom pushed a commit that referenced this issue Oct 31, 2019
Sometimes govmomi will return a PortGroup spec where the failure
criteria property of the nic teaming policy can be nil.

When this happens we crash because the code doesn't check for this case.

Addresses the crash in #869
@koikonom koikonom added the waiting-response Status: Waiting on a Response label Oct 31, 2019
koikonom pushed a commit that referenced this issue Oct 31, 2019
Sometimes govmomi will return a PortGroup spec where the failure
criteria property of the nic teaming policy can be nil.

When this happens we crash because the code doesn't check for this case.

Addresses the crash in #869
@aareet
Copy link
Contributor

aareet commented Nov 21, 2019

I am closing this issue since it has been waiting for a response for 22 days. Please reopen if this is reproducible. Additionally, we've issued a fix in a4b6343 that might have fixed this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
crash Impact: Crash
Projects
None yet
Development

No branches or pull requests

4 participants