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

OVF deployment failure (v1.24.1) #1239

Closed
scluff opened this issue Oct 16, 2020 · 8 comments
Closed

OVF deployment failure (v1.24.1) #1239

scluff opened this issue Oct 16, 2020 · 8 comments
Labels
bug Type: Bug

Comments

@scluff
Copy link

scluff commented Oct 16, 2020

Terraform Version

0.13.4

vSphere Provider Version

1.24.1

Affected Resource(s)

  • vsphere_virtual_machine

Terraform Configuration Files

terraform {
  required_providers {
    vsphere = {
      source  = "hashicorp/vsphere"
      version = "1.24.1"
    }
  }
}

variable "vsphere_user" {
  type        = string
  description = "This is the username for vSphere API operations."
}

variable "vsphere_password" {
  type        = string
  description = "This is the password for vSphere API operations."
}

variable "vsphere_server" {
  type        = string
  description = "This is the vCenter server name for vSphere API operations."
}

variable "vsphere_insecure" {
  type        = bool
  description = "Boolean that can be set to true to disable SSL certificate verification. This should be used with care as it could allow an attacker to intercept your auth token."
  default     = false
}

variable "vsphere_datacenter" {
  type = string
}

variable "vsphere_cluster" {
  type = string
}

variable "vsphere_host" {
  type = string
}

variable "vsphere_datastore" {
  type = string
}

variable "vsphere_dvs" {
  type = string
}

variable "network_grid" {
  type = string
}

variable "network_admin" {
  type = string
}

variable "network_client" {
  type = string
}

provider "vsphere" {
  user                 = var.vsphere_user
  password             = var.vsphere_password
  vsphere_server       = var.vsphere_server
  allow_unverified_ssl = var.vsphere_insecure
}

data "vsphere_datacenter" "datacenter" {
  name = var.vsphere_datacenter
}

data "vsphere_resource_pool" "pool" {
  name          = "${var.vsphere_cluster}/Resources"
  datacenter_id = data.vsphere_datacenter.datacenter.id
}

data "vsphere_host" "host" {
  name          = var.vsphere_host
  datacenter_id = data.vsphere_datacenter.datacenter.id
}

data "vsphere_datastore" "datastore" {
  name          = var.vsphere_datastore
  datacenter_id = data.vsphere_datacenter.datacenter.id
}

data "vsphere_distributed_virtual_switch" "dvs" {
  name          = var.vsphere_dvs
  datacenter_id = data.vsphere_datacenter.datacenter.id
}

data "vsphere_network" "grid" {
  name                            = var.network_grid
  datacenter_id                   = data.vsphere_datacenter.datacenter.id
  distributed_virtual_switch_uuid = data.vsphere_distributed_virtual_switch.dvs.id
}

data "vsphere_network" "admin" {
  name                            = var.network_admin
  datacenter_id                   = data.vsphere_datacenter.datacenter.id
  distributed_virtual_switch_uuid = data.vsphere_distributed_virtual_switch.dvs.id
}

data "vsphere_network" "client" {
  name                            = var.network_client
  datacenter_id                   = data.vsphere_datacenter.datacenter.id
  distributed_virtual_switch_uuid = data.vsphere_distributed_virtual_switch.dvs.id
}

resource "vsphere_virtual_machine" "primary-admin" {
  name                       = "sglab-primary-admin"
  datacenter_id              = data.vsphere_datacenter.datacenter.id
  resource_pool_id           = data.vsphere_resource_pool.pool.id
  host_system_id             = data.vsphere_host.host.id
  datastore_id               = data.vsphere_datastore.datastore.id
  wait_for_guest_net_timeout = 0
  num_cpus                   = 8
  memory_reservation         = 0

  ovf_deploy {
    local_ovf_path    = "/home/scluff/StorageGRID-Webscale-11.4.0/vsphere/vsphere-primary-admin.ovf"
    disk_provisioning = "thin"
    ovf_network_map = {
      "Grid Network"   = data.vsphere_network.grid.id
      "Admin Network"  = data.vsphere_network.admin.id
      "Client Network" = data.vsphere_network.client.id
    }
  }
  lifecycle {
    ignore_changes = [
      host_system_id
    ]
  }
  vapp {
    properties = {
      "GRID_NETWORK_GATEWAY" = "10.0.0.1"
      "GRID_NETWORK_IP"      = "10.0.0.2"
      "GRID_NETWORK_MASK"    = "255.255.255.0"
      "NODE_NAME"            = "primary-admin"
    }
  }
}

Debug Output

2020-10-15T17:36:14.063-0700 [DEBUG] plugin.terraform-provider-vsphere_v1.24.1_x4: panic: runtime error: index out of range [0] with length 0
2020-10-15T17:36:14.063-0700 [DEBUG] plugin.terraform-provider-vsphere_v1.24.1_x4:
2020-10-15T17:36:14.063-0700 [DEBUG] plugin.terraform-provider-vsphere_v1.24.1_x4: goroutine 52 [running]:
2020-10-15T17:36:14.063-0700 [DEBUG] plugin.terraform-provider-vsphere_v1.24.1_x4: github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/virtualdevice.DiskPostCloneOperation(0xc000548f50, 0xc00049e010, 0xc000213100, 0x10, 0x10, 0x5, 0xc000663100, 0x5, 0x8, 0x5, ...)
2020-10-15T17:36:14.063-0700 [DEBUG] plugin.terraform-provider-vsphere_v1.24.1_x4:      /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/virtualdevice/virtual_machine_disk_subresource.go:1008 +0x23d7

Panic Output

https://gist.github.com/scluff/84393828e05d7cf5f7cf8c6e815e2f5d

Expected Behavior

The OVF is deployed and the VM starts

Actual Behavior

The OVF is deployed but the VM does not start

Steps to Reproduce

  1. terraform apply

Important Factoids

Works correctly with the 1.24.0 provider

References

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment
@scluff scluff added the bug Type: Bug label Oct 16, 2020
@Eslih
Copy link

Eslih commented Oct 20, 2020

I am having the same issue. More precisely I try to deploy virtual ESXi hosts. Used the script available at https://www.virtuallyghetto.com/2020/06/full-ova-ovf-property-support-coming-to-terraform-provider-for-vsphere.html

I am using the vsphere v1.24.2 plugin, terraform 0.13.4.

@Eslih
Copy link

Eslih commented Oct 20, 2020

I am having the same issue. More precisely I try to deploy virtual ESXi hosts. Used the script available at https://www.virtuallyghetto.com/2020/06/full-ova-ovf-property-support-coming-to-terraform-provider-for-vsphere.html

I am using the vsphere v1.24.2 plugin, terraform 0.13.4.

I just downgraded the plugin version to v1.24.0. This seems to work like expected!

@adarobin
Copy link
Contributor

#1218 seems to have caused this issue. It looks like all of the arguments that had the DiffSuppressFunc removed from them get deleted after the OVF has been cloned because they aren't declared in the TF code. I noticed this trying to deploy a nested ESXi appliance and discovering all of my network cards were gone after a reconfiguration that got kicked off after the deployment.

I confirmed this locally. I pulled master and then ran git revert 649c894744ded10e22b14ac89bb2f881ac836c84. With that done and compiled I am able to deploy the nested ESXi appliance as in v1.24.0.

@adarobin
Copy link
Contributor

@bill-rich Is #1218 working as intended? Should I need to have all of these different hardware elements declared in my resource when I am deploying an OVF?

@tenthirtyam
Copy link
Collaborator

@scluff -

Have you tested deploying the OVA with the latest (e.g. v2.0.2) version of the provider?

See #1227 (comment) for an example using the Nested_ESXi7.0u3_Appliance_Template_v1.ova OVA image along with the vsphere_ovf_vm_template data source.

Ryan

@tenthirtyam tenthirtyam added the waiting-response Status: Waiting on a Response label Jan 29, 2022
@tenthirtyam
Copy link
Collaborator

@scluff -

Have you tested deploying the OVA with the latest (e.g. v2.0.2) version of the provider?

See #1227 (comment) for an example using the Nested_ESXi7.0u3_Appliance_Template_v1.ova OVA image along with the vsphere_ovf_vm_template data source.

Ryan Johnson
Staff II Solutions Architect, VMware, Inc.

@github-actions github-actions bot removed the waiting-response Status: Waiting on a Response label Feb 3, 2022
@tenthirtyam tenthirtyam added the waiting-response Status: Waiting on a Response label Feb 3, 2022
@tenthirtyam tenthirtyam changed the title OVF deployment fails with provider 1.24.1 OVF deployment failure (v1.24.1) Feb 4, 2022
@tenthirtyam
Copy link
Collaborator

Marking this issue as resolved based on the solution example provided in the previous comments (1) (2) with the example for deploying the Nested_ESXi7.0u3_Appliance_Template_v1.ova OVA image.

If the issue persists with the solution provided, the latest version of the provider, and the recommended use of the vsphere_ovf_vm_template data source, please open a new issue and reference this issue for additional context.

Ryan Johnson
Staff II Solutions Architect, VMware, Inc.

@github-actions github-actions bot removed the waiting-response Status: Waiting on a Response label Feb 8, 2022
@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Type: Bug
Projects
None yet
Development

No branches or pull requests

4 participants