Skip to content

Commit 544b583

Browse files
committed
demo with ISO
Signed-off-by: Justin Cinkelj <justin.cinkelj@xlab.si>
1 parent 9141d4c commit 544b583

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

demo/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Prepare:
33
- Since demo does not try to import existing resources:
44
- Remove VM `testtf-demo`, if it exists.
55
- Remove virtual disk `jammy-server-cloudimg-amd64.img`, if it exists.
6+
- Remove ISO `alpine-virt-3.21.3-x86_64.iso`, if it exists
67

78
Follow [top level README.md](../README.md) to install terraform and golang.
89

demo/sc_demo_vm.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ resource "hypercore_disk" "os" {
3131
source_virtual_disk_id = hypercore_virtual_disk.ubuntu_2204.id
3232
}
3333

34+
resource "hypercore_disk" "iso" {
35+
vm_uuid = hypercore_vm.demo_vm.id
36+
type = "IDE_CDROM"
37+
iso_uuid = hypercore_iso.alpine_virt.id
38+
}
39+
3440
resource "hypercore_nic" "vlan_all" {
3541
vm_uuid = hypercore_vm.demo_vm.id
3642
type = "VIRTIO"
@@ -47,6 +53,7 @@ resource "hypercore_vm_power_state" "demo_vm" {
4753
state = "RUNNING" # available states are: SHUTOFF, RUNNING, PAUSED
4854
depends_on = [
4955
hypercore_disk.os,
56+
hypercore_disk.iso,
5057
hypercore_nic.vlan_all,
5158
hypercore_vm_boot_order.demo_vm_boot_order,
5259
]
@@ -56,11 +63,13 @@ resource "hypercore_vm_boot_order" "demo_vm_boot_order" {
5663
vm_uuid = hypercore_vm.demo_vm.id
5764
boot_devices = [
5865
hypercore_disk.os.id,
66+
hypercore_disk.iso.id,
5967
hypercore_nic.vlan_all.id,
6068
]
6169

6270
depends_on = [
6371
hypercore_disk.os,
72+
hypercore_disk.iso,
6473
hypercore_nic.vlan_all,
6574
]
6675
}

demo/sc_iso_image.tf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Copyright (c) HashiCorp, Inc.
2+
# SPDX-License-Identifier: MPL-2.0
3+
4+
resource "hypercore_iso" "alpine_virt" {
5+
name = "alpine-virt-3.21.3-x86_64.iso"
6+
source_url = "https://dl-cdn.alpinelinux.org/alpine/v3.21/releases/x86_64/alpine-virt-3.21.3-x86_64.iso"
7+
}
8+
9+
output "alpine_iso" {
10+
value = hypercore_iso.alpine_virt
11+
}

0 commit comments

Comments
 (0)