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

failed to attached the network while creating vm using template from ContentLibrary #2287

Open
4 tasks done
hussainaphroj opened this issue Oct 21, 2024 · 5 comments
Open
4 tasks done
Labels
bug Type: Bug needs-triage Status: Issue Needs Triage question/provider Question: Provider

Comments

@hussainaphroj
Copy link

hussainaphroj commented Oct 21, 2024

Community Guidelines

  • I have read and agree to the HashiCorp Community Guidelines .
  • Vote on this issue by adding a 👍 reaction to the original issue initial description to help the maintainers prioritize.
  • Do not leave "+1" or other comments that do not add relevant information or questions.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Terraform

1.7.5

Terraform Provider

2.10.0

VMware vSphere

8.0.3.00300

Description

I am attempting to create a Windows VM using a sysprepped template from the Content Library. However, the process failed during customization. Upon reviewing the customization logs, I found that the failure occurred when trying to attach the network.

Affected Resources or Data Sources

resource/vsphere_virtual_machine

Terraform Configuration

resource "vsphere_virtual_machine" "tf-win-02" {
  name                 = "tf-win-02"
  resource_pool_id     = data.vsphere_compute_cluster.dc-dev-local-cluster-dev-local.resource_pool_id

  num_cpus = 4
  memory   = 8192       # Unit in MB

  firmware = "efi"

  efi_secure_boot_enabled = true

  nested_hv_enabled = true

  vvtd_enabled = true

  vbs_enabled = true

  network_interface {
    network_id   = data.vsphere_network.dc-dev-local-vl-123.id
    adapter_type = "vmxnet3"
  }

  disk {
    unit_number                 = 0
    label                       = "disk0"
    size                        = 50
    eagerly_scrub               = false
    thin_provisioned            = true
  }

  disk {
    unit_number                 = 1
    label                       = "disk1"
    size                        = 5
    eagerly_scrub               = false
    thin_provisioned            = true
  }

  clone {
    template_uuid = data.vsphere_content_library_item.Template-WIN2019.id

    customize {
      timeout = 20

      windows_options {
        computer_name  = "tf-win-02"    # required
        admin_password = var.vm_pass         # recommended to set password
        time_zone      = "165"        # Dubai timezone
      }

      network_interface {
        ipv4_address = "x.x.x.x"
        ipv4_netmask = 24
        dns_server_list = ["x.x.x.x","x.x.x.x"]
      }

      ipv4_gateway = "x.x.x.x"
    }
  }
}

Debug Output

An error occurred while customizing VM tf-win-02. For details reference the log file C:/Windows/TEMP/vmware-imc/guestcust.log in the guest OS.

│ The virtual machine has not been deleted to assist with troubleshooting. If
│ corrective steps are taken without modifying the "customize" block of the
│ resource configuration, the resource will need to be tainted before trying
│ again. For more information on how to do this, see the following page:
│ https://www.terraform.io/docs/commands/taint.html


│   with vsphere_virtual_machine.tf-win-02,
│   on main.tf line 45, in resource "vsphere_virtual_machine" "tf-win-02":
│   45: resource "vsphere_virtual_machine" "tf-win-02" {

Panic Output

No response

Expected Behavior

It should customized the newly created vm and attached the network

Actual Behavior

It should customized the newly created vm and attached the network

Steps to Reproduce

Provision a vm from a syspreped template

Environment Details

No response

Screenshots

No response

References

No response

@hussainaphroj hussainaphroj added bug Type: Bug needs-triage Status: Issue Needs Triage labels Oct 21, 2024
Copy link

Hello, hussainaphroj! 🖐

Thank you for submitting an issue for this provider. The issue will now enter into the issue lifecycle.

If you want to contribute to this project, please review the contributing guidelines and information on submitting pull requests.

@tenthirtyam tenthirtyam added the question/provider Question: Provider label Nov 5, 2024
@tenthirtyam tenthirtyam self-assigned this Nov 5, 2024
@datacore-bwynne
Copy link

Hello, I am experiencing a similar issue, I have a question.
I only hit this issue when trying to deploy a Windows Server 2025
I can use the same terraform code to deploy a Windows Server 2022 without issue.
What version of Windows are you trying to deploy?

@Jding2159
Copy link

Having the same issue also with Windows 11 template and Windows server 2025.

Works on Win 10, Win 2019, and Win 2022 template.

@hussainaphroj
Copy link
Author

@datacore-bwynne I'm encountering this issue with nearly all Windows templates, including WIN 2016, 2019, and 2022. The main problem is with templates that are Sysprepped. If the template isn’t Sysprepped, it provisions without any issues.

@Jding2159
Copy link

@hussainaphroj Turns out I just have to make sure the template is fully updated and doesnt have anything else pending. Mine is working now.

@tenthirtyam tenthirtyam removed their assignment Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Type: Bug needs-triage Status: Issue Needs Triage question/provider Question: Provider
Projects
None yet
Development

No branches or pull requests

4 participants