https://rancher.com/ logo
#harvester
Title
# harvester
s

sticky-summer-13450

12/28/2022, 4:17 PM
Copy code
resource "harvester_virtualmachine" "ubuntu2204" {
  name                 = "ubuntu2204"
  namespace            = "default"
  restart_after_update = true

  description = "test ubuntu2203 raw image terraform"
  tags = {
    ssh-user = "ubuntu"
  }

  cpu    = 2
  memory = "2Gi"

  efi         = false
  secure_boot = false

  run_strategy = "RerunOnFailure"
  hostname     = "ubuntu2204"
  machine_type = "q35"

  network_interface {
    name           = "nic-1"
    network_name   = "vlan648"
    model          = "virtio"
    type           = "bridge"
    wait_for_lease = false
  }

  disk {
    name        = "rootdisk"
    size        = "10Gi"
    type        = "disk"
    bus         = "virtio"
    boot_order  = 1
    image       = "jammy-server-cloudimg-amd64.img"
    auto_delete = true
  }

  cloudinit {
    user_data    = <<-EOF
      #cloud-config
      EOF
...
    network_data = <<-EOF
      network:
        version: 1
        config:
...
      EOF
  }
}
Also in the Harvester Terraform schema docs I can't see how to "Enable USB tablet".
b

bland-farmer-13503

12/29/2022, 2:00 AM
Actually,
jammy-server-cloudimage-amd64.img
is just a display name. It's not the name of VMImage CRD. You can use
kubectl get vmimage
to see it. In terraform, you can use following to get the image.
Copy code
data "harvester_image" "ubuntu" {
  namespace    = "default"
  display_name = "jammy-server-cloudimage-amd64.img"
}
Enable USB tablet
is not supported yet. You can check this PR. Thanks. https://github.com/harvester/terraform-provider-harvester/pull/63
s

sticky-summer-13450

12/31/2022, 11:17 AM
Thank you - that helped.
8 Views