Skip to content

VM is not powered on after creation on XCP-ng #126

Description

@HaroldVB

Hi team,

We're attempting to create some VMs on XCP-ng using this provider.
However when we create the VMs they stay powered off after successful creation.
We would also like to retrieve the IP from the machine after it's started so we can provision the machine automatically using other tools.
Our custom template already has xe-guest-utilities installed.

main.tf

data "xenserver_sr" "sr" {
  name_label = "Local storage"
}

data "xenserver_network" "network" {}

resource "xenserver_vm" "vm" {
  name_label       = "vm"
  template_name    = "Ubuntu Noble"
  static_mem_max   = 2 * 1024 * 1024 * 1024
  boot_mode        = "uefi"

  vcpus            = 2
  cores_per_socket = 1
  sr_for_full_disk_copy = data.xenserver_sr.sr.data_items[0].uuid

  network_interface = [
    {
      device       = "0"
      network_uuid = data.xenserver_network.network.data_items[0].uuid,
    },
  ]
}

output "vm_out" {
    value = xenserver_vm.vm
}

outputs

Outputs:

vm_out = {
  "boot_mode" = "uefi"
  "boot_order" = "cd"
  "cdrom" = ""
  "check_ip_timeout" = 0
  "cores_per_socket" = 1
  "default_ip" = ""
  "dynamic_mem_max" = 2147483648
  "dynamic_mem_min" = 2147483648
  "hard_drive" = toset([])
  "id" = "2e8d0a4d-ad1c-a8a5-27b5-1f3df52100c7"
  "name_description" = ""
  "name_label" = "vm"
  "network_interface" = toset([
    {
      "device" = "0"
      "mac" = "5e:10:c3:d2:3c:f9"
      "network_uuid" = "15753669-75c6-0fef-65e2-b8fb5c81185f"
      "other_config" = tomap({})
    },
  ])
  "other_config" = tomap({})
  "sr_for_full_disk_copy" = "6a3dc573-6ad3-eee4-bb1d-51f35eb393c2"
  "static_mem_max" = 2147483648
  "static_mem_min" = 2147483648
  "template_name" = "Ubuntu Noble"
  "uuid" = "2e8d0a4d-ad1c-a8a5-27b5-1f3df52100c7"
  "vcpus" = 2
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions