-
Notifications
You must be signed in to change notification settings - Fork 1
/
flatcar.pkr.hcl
41 lines (35 loc) · 1022 Bytes
/
flatcar.pkr.hcl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
locals {
version = var.version != "" ? var.version : local.flatcar_version_info.FLATCAR_VERSION_ID
download_url = "https://stable.release.flatcar-linux.net/${var.arch}-usr/${local.version}/flatcar_production_image.bin.bz2"
snapshot_name = "${var.snapshot_prefix}${local.version}-${var.arch}"
}
source "hcloud" "builder" {
image = "ubuntu-22.04"
location = "${var.location}"
rescue = "linux64"
server_type = "${local.server_type}"
snapshot_name = "${local.snapshot_name}"
ssh_username = "root"
snapshot_labels = {
image_type = "${var.image_type}"
os = "flatcar"
}
}
build {
sources = ["source.hcloud.builder"]
provisioner "shell" {
inline = [
"curl -fsSL ${local.download_url} | bzcat | dd if=/dev/stdin of=/dev/sda bs=64k",
"mount /dev/sda6 /mnt"
]
}
provisioner "file" {
destination = "/mnt/grub.cfg"
source = "${var.grub_config}"
}
provisioner "shell" {
inline = [
"umount /mnt"
]
}
}